From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 9838F1FF179 for ; Wed, 7 Jan 2026 10:15:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0002871CF; Wed, 7 Jan 2026 10:16:08 +0100 (CET) From: Kefu Chai To: pve-devel@lists.proxmox.com Date: Tue, 6 Jan 2026 22:24:35 +0800 Message-ID: <20260106142440.2368585-12-k.chai@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260106142440.2368585-1-k.chai@proxmox.com> References: <20260106142440.2368585-1-k.chai@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1767709501073 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.110 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [188.114.97.3, 188.114.96.3] X-Mailman-Approved-At: Wed, 07 Jan 2026 10:16:04 +0100 Subject: [pve-devel] [PATCH pve-cluster 11/15] pmxcfs-rs: vendor patched rust-corosync for CPG compatibility X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Add vendored rust-corosync library with CPG group name fix to support optional trailing nuls in group names, ensuring compatibility between Rust and C pmxcfs implementations. The patch addresses a limitation in CString::new() which doesn't allow trailing \0 in its input, while C code uses strlen(name) + 1 for CPG group names (including the trailing nul). This vendored version will be replaced once the fix is upstreamed and a new rust-corosync crate version is published. See: vendor/rust-corosync/README.PATCH.md for details --- src/pmxcfs-rs/Cargo.toml | 6 + src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml | 33 + .../vendor/rust-corosync/Cargo.toml.orig | 19 + src/pmxcfs-rs/vendor/rust-corosync/LICENSE | 21 + .../vendor/rust-corosync/README.PATCH.md | 36 + src/pmxcfs-rs/vendor/rust-corosync/README.md | 13 + src/pmxcfs-rs/vendor/rust-corosync/build.rs | 64 + .../vendor/rust-corosync/regenerate-sys.sh | 15 + src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs | 392 ++ .../vendor/rust-corosync/src/cmap.rs | 812 ++++ src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs | 657 ++++ src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs | 297 ++ .../vendor/rust-corosync/src/quorum.rs | 337 ++ .../vendor/rust-corosync/src/sys/cfg.rs | 1239 ++++++ .../vendor/rust-corosync/src/sys/cmap.rs | 3323 +++++++++++++++++ .../vendor/rust-corosync/src/sys/cpg.rs | 1310 +++++++ .../vendor/rust-corosync/src/sys/mod.rs | 8 + .../vendor/rust-corosync/src/sys/quorum.rs | 537 +++ .../rust-corosync/src/sys/votequorum.rs | 574 +++ .../vendor/rust-corosync/src/votequorum.rs | 556 +++ 20 files changed, 10249 insertions(+) create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/LICENSE create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/README.md create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/build.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/regenerate-sys.sh create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cmap.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/quorum.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cfg.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cmap.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cpg.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/mod.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/quorum.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/votequorum.rs create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/votequorum.rs diff --git a/src/pmxcfs-rs/Cargo.toml b/src/pmxcfs-rs/Cargo.toml index 4d18aa93..a178bc27 100644 --- a/src/pmxcfs-rs/Cargo.toml +++ b/src/pmxcfs-rs/Cargo.toml @@ -91,3 +91,9 @@ strip = true [profile.dev] opt-level = 1 debug = true + +[patch.crates-io] +# Temporary patch for CPG group name length bug +# Fixed in corosync upstream (commit 71d6d93c) but not yet released +# Remove this patch when rust-corosync > 0.1.0 is published +rust-corosync = { path = "vendor/rust-corosync" } diff --git a/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml new file mode 100644 index 00000000..f299ca76 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml @@ -0,0 +1,33 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +edition = "2018" +name = "rust-corosync" +version = "0.1.0" +authors = ["Christine Caulfield "] +description = "Rust bindings for corosync libraries" +readme = "README.md" +keywords = ["cluster", "high-availability"] +categories = ["api-bindings"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/chrissie-c/rust-corosync" +[dependencies.bitflags] +version = "1.2.1" + +[dependencies.lazy_static] +version = "1.4.0" + +[dependencies.num_enum] +version = "0.5.1" +[build-dependencies.pkg-config] +version = "0.3" diff --git a/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig new file mode 100644 index 00000000..2165c8e9 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig @@ -0,0 +1,19 @@ +[package] +name = "rust-corosync" +version = "0.1.0" +authors = ["Christine Caulfield "] +edition = "2018" +readme = "README.md" +license = "MIT OR Apache-2.0" +repository = "https://github.com/chrissie-c/rust-corosync" +description = "Rust bindings for corosync libraries" +categories = ["api-bindings"] +keywords = ["cluster", "high-availability"] + +[dependencies] +lazy_static = "1.4.0" +num_enum = "0.5.1" +bitflags = "1.2.1" + +[build-dependencies] +pkg-config = "0.3" diff --git a/src/pmxcfs-rs/vendor/rust-corosync/LICENSE b/src/pmxcfs-rs/vendor/rust-corosync/LICENSE new file mode 100644 index 00000000..43da7b99 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Chrissie Caulfield + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md b/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md new file mode 100644 index 00000000..c8ba2d6f --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md @@ -0,0 +1,36 @@ +# Temporary Vendored rust-corosync v0.1.0 + +This is a temporary vendored copy of `rust-corosync` v0.1.0 with a critical bug fix. + +## Why Vendored? + +The published `rust-corosync` v0.1.0 on crates.io has a bug that prevents Rust and C applications from joining the same CPG groups. This bug has been fixed in corosync upstream but not yet released. + +## Upstream Fix + +The fix has been committed to the corosync repository: +- Repository: https://github.com/corosync/corosync +- Local commit: `~/dev/corosync` commit 71d6d93c +- File: `bindings/rust/src/cpg.rs` +- Lines changed: 209-220 + +## The Bug + +CPG group name length calculation was excluding the null terminator: +- C code: `length = strlen(name) + 1` (includes \0) +- Rust (before): `length = name.len()` (excludes \0) +- Rust (after): `length = name.len() + 1` (includes \0) + +This caused Rust and C nodes to be isolated in separate CPG groups even when using identical group names. + +## Removal Plan + +Once `rust-corosync` v0.1.1+ is published with this fix: + +1. Remove this `vendor/rust-corosync` directory +2. Remove the `[patch.crates-io]` section from `../Cargo.toml` +3. Update workspace dependency to `rust-corosync = "0.1.1"` + +## Testing + +The fix has been tested with mixed C/Rust pmxcfs clusters and verified that all nodes successfully join the same CPG group and communicate properly. diff --git a/src/pmxcfs-rs/vendor/rust-corosync/README.md b/src/pmxcfs-rs/vendor/rust-corosync/README.md new file mode 100644 index 00000000..9c376b8a --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/README.md @@ -0,0 +1,13 @@ +# rust-corosync +Rust bindings for corosync + +This crate covers Rust bindings for the +cfg, cmap, cpg, quorum, votequorum +libraries in corosync. + +It is very much in an alpha state at the moment and APIs +may well change as and when people start to use them. + +Please report bugs and offer any suggestions to ccaulfie@redhat.com + +https://corosync.github.io/corosync/ diff --git a/src/pmxcfs-rs/vendor/rust-corosync/build.rs b/src/pmxcfs-rs/vendor/rust-corosync/build.rs new file mode 100644 index 00000000..8635b5e4 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/build.rs @@ -0,0 +1,64 @@ +extern crate pkg_config; + +fn main() { + if let Err(e) = pkg_config::probe_library("libcpg") { + match e { + pkg_config::Error::Failure { .. } => panic! ( + "Pkg-config failed - usually this is because corosync development headers are not installed.\n\n\ + For Fedora users:\n# dnf install corosynclib-devel\n\n\ + For Debian/Ubuntu users:\n# apt-get install libcpg-dev\n\n\ + pkg_config details:\n{}", + e + ), + _ => panic!("{}", e) + } + } + if let Err(e) = pkg_config::probe_library("libquorum") { + match e { + pkg_config::Error::Failure { .. } => panic! ( + "Pkg-config failed - usually this is because corosync development headers are not installed.\n\n\ + For Fedora users:\n# dnf install corosynclib-devel\n\n\ + For Debian/Ubuntu users:\n# apt-get install libquorum-dev\n\n\ + pkg_config details:\n{}", + e + ), + _ => panic!("{}", e) + } + } + if let Err(e) = pkg_config::probe_library("libvotequorum") { + match e { + pkg_config::Error::Failure { .. } => panic! ( + "Pkg-config failed - usually this is because corosync development headers are not installed.\n\n\ + For Fedora users:\n# dnf install corosynclib-devel\n\n\ + For Debian/Ubuntu users:\n# apt-get install libvotequorum-dev\n\n\ + pkg_config details:\n{}", + e + ), + _ => panic!("{}", e) + } + } + if let Err(e) = pkg_config::probe_library("libcfg") { + match e { + pkg_config::Error::Failure { .. } => panic! ( + "Pkg-config failed - usually this is because corosync development headers are not installed.\n\n\ + For Fedora users:\n# dnf install corosynclib-devel\n\n\ + For Debian/Ubuntu users:\n# apt-get install libcfg-dev\n\n\ + pkg_config details:\n{}", + e + ), + _ => panic!("{}", e) + } + } + if let Err(e) = pkg_config::probe_library("libcmap") { + match e { + pkg_config::Error::Failure { .. } => panic! ( + "Pkg-config failed - usually this is because corosync development headers are not installed.\n\n\ + For Fedora users:\n# dnf install corosynclib-devel\n\n\ + For Debian/Ubuntu users:\n# apt-get install libcmap-dev\n\n\ + pkg_config details:\n{}", + e + ), + _ => panic!("{}", e) + } + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/regenerate-sys.sh b/src/pmxcfs-rs/vendor/rust-corosync/regenerate-sys.sh new file mode 100644 index 00000000..4b958663 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/regenerate-sys.sh @@ -0,0 +1,15 @@ +# +# Regerate the FFI bindings in src/sys from the current Corosync headers +# +regen() +{ + bindgen --size_t-is-usize --no-recursive-whitelist --no-prepend-enum-name --no-layout-tests --no-doc-comments --generate functions,types /usr/include/corosync/$1.h -o src/sys/$1.rs +} + + +regen cpg +regen cfg +regen cmap +regen quorum +regen votequorum + diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs new file mode 100644 index 00000000..f334f525 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs @@ -0,0 +1,392 @@ +// libcfg interface for Rust +// Copyright (c) 2021 Red Hat, Inc. +// +// All rights reserved. +// +// Author: Christine Caulfield (ccaulfi@redhat.com) +// + +// For the code generated by bindgen +use crate::sys::cfg as ffi; + +use std::os::raw::{c_void, c_int}; +use std::collections::HashMap; +use std::sync::Mutex; +use std::ffi::CString; + +use crate::{CsError, DispatchFlags, Result, NodeId}; +use crate::string_from_bytes; + +// Used to convert a CFG handle into one of ours +lazy_static! { + static ref HANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); +} + +/// Callback from [track_start]. Will be called if another process +/// requests to shut down corosync. [reply_to_shutdown] should be called +/// with a [ShutdownReply] of either Yes or No. +#[derive(Copy, Clone)] +pub struct Callbacks { + pub corosync_cfg_shutdown_callback_fn: Option +} + +/// A handle into the cfg library. returned from [initialize] and needed for all other calls +#[derive(Copy, Clone)] +pub struct Handle { + cfg_handle: u64, + callbacks: Callbacks +} + +/// Flags for [try_shutdown] +pub enum ShutdownFlags +{ + /// Request shutdown (other daemons will be consulted) + Request, + /// Tells other daemons but ignore their opinions + Regardless, + /// Go down straight away (but still tell other nodes) + Immediate, +} + +/// Responses for [reply_to_shutdown] +pub enum ShutdownReply +{ + Yes = 1, + No = 0 +} + +/// Trackflags for [track_start]. None currently supported +pub enum TrackFlags +{ + None, +} + +/// Version of the [NodeStatus] structure returned from [node_status_get] +pub enum NodeStatusVersion +{ + V1, +} + +/// Status of a link inside [NodeStatus] struct +pub struct LinkStatus +{ + pub enabled: bool, + pub connected: bool, + pub dynconnected: bool, + pub mtu: u32, + pub src_ipaddr: String, + pub dst_ipaddr: String, +} + +/// Structure returned from [node_status_get], shows all the details of a node +/// that is known to corosync, including all configured links +pub struct NodeStatus +{ + pub version: NodeStatusVersion, + pub nodeid: NodeId, + pub reachable: bool, + pub remote: bool, + pub external: bool, + pub onwire_min: u8, + pub onwire_max: u8, + pub onwire_ver: u8, + pub link_status: Vec, +} + +extern "C" fn rust_shutdown_notification_fn(handle: ffi::corosync_cfg_handle_t, flags: u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + match h.callbacks.corosync_cfg_shutdown_callback_fn { + Some(cb) => + (cb)(h, flags), + None => {} + } + } + None => {} + } +} + + +/// Initialize a connection to the cfg library. You must call this before doing anything +/// else and use the passed back [Handle]. +/// Remember to free the handle using [finalize] when finished. +pub fn initialize(callbacks: &Callbacks) -> Result +{ + let mut handle: ffi::corosync_cfg_handle_t = 0; + + let mut c_callbacks = ffi::corosync_cfg_callbacks_t { + corosync_cfg_shutdown_callback: Some(rust_shutdown_notification_fn), + }; + + unsafe { + let res = ffi::corosync_cfg_initialize(&mut handle, + &mut c_callbacks); + if res == ffi::CS_OK { + let rhandle = Handle{cfg_handle: handle, callbacks: callbacks.clone()}; + HANDLE_HASH.lock().unwrap().insert(handle, rhandle); + Ok(rhandle) + } else { + Err(CsError::from_c(res)) + } + } +} + + +/// Finish with a connection to corosync, after calling this the [Handle] is invalid +pub fn finalize(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_finalize(handle.cfg_handle) + }; + if res == ffi::CS_OK { + HANDLE_HASH.lock().unwrap().remove(&handle.cfg_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// not sure if an fd is the right thing to return here, but it will do for now. +/// Returns a file descriptor to use for poll/select on the CFG handle +pub fn fd_get(handle: Handle) -> Result +{ + let c_fd: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let res = + unsafe { + ffi::corosync_cfg_fd_get(handle.cfg_handle, c_fd) + }; + if res == ffi::CS_OK { + Ok(unsafe { *c_fd }) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the local [NodeId] +pub fn local_get(handle: Handle) -> Result +{ + let mut nodeid: u32 = 0; + let res = + unsafe { + ffi::corosync_cfg_local_get(handle.cfg_handle, &mut nodeid) + }; + if res == ffi::CS_OK { + Ok(NodeId::from(nodeid)) + } else { + Err(CsError::from_c(res)) + } +} + +/// Reload the cluster configuration on all nodes +pub fn reload_cnfig(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_reload_config(handle.cfg_handle) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Re-open the cluster log files, on this node only +pub fn reopen_log_files(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_reopen_log_files(handle.cfg_handle) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Tell another cluster node to shutdown. reason is a string that +/// will be written to the system log files. +pub fn kill_node(handle: Handle, nodeid: NodeId, reason: &String) -> Result<()> +{ + let c_string = { + match CString::new(reason.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let res = + unsafe { + ffi::corosync_cfg_kill_node(handle.cfg_handle, u32::from(nodeid), c_string.as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Ask this cluster node to shutdown. If [ShutdownFlags] is set to Request then +///it may be refused by other applications +/// that have registered for shutdown callbacks. +pub fn try_shutdown(handle: Handle, flags: ShutdownFlags) -> Result<()> +{ + let c_flags = match flags { + ShutdownFlags::Request => 0, + ShutdownFlags::Regardless => 1, + ShutdownFlags::Immediate => 2 + }; + let res = + unsafe { + ffi::corosync_cfg_try_shutdown(handle.cfg_handle, c_flags) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Reply to a shutdown request with Yes or No [ShutdownReply] +pub fn reply_to_shutdown(handle: Handle, flags: ShutdownReply) -> Result<()> +{ + let c_flags = match flags { + ShutdownReply::No => 0, + ShutdownReply::Yes => 1, + }; + let res = + unsafe { + ffi::corosync_cfg_replyto_shutdown(handle.cfg_handle, c_flags) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Call any/all active CFG callbacks for this [Handle] see [DispatchFlags] for details +pub fn dispatch(handle: Handle, flags: DispatchFlags) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_dispatch(handle.cfg_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// Quick & dirty u8 to boolean +fn u8_to_bool(val: u8) -> bool +{ + if val == 0 {false} else {true} +} + +const CFG_MAX_LINKS: usize = 8; +const CFG_MAX_HOST_LEN: usize = 256; +fn unpack_nodestatus(c_nodestatus: ffi::corosync_cfg_node_status_v1) -> Result +{ + let mut ns = NodeStatus { + version: NodeStatusVersion::V1, + nodeid: NodeId::from(c_nodestatus.nodeid), + reachable: u8_to_bool(c_nodestatus.reachable), + remote: u8_to_bool(c_nodestatus.remote), + external: u8_to_bool(c_nodestatus.external), + onwire_min: c_nodestatus.onwire_min, + onwire_max: c_nodestatus.onwire_max, + onwire_ver: c_nodestatus.onwire_min, + link_status: Vec::::new() + }; + for i in 0..CFG_MAX_LINKS { + let ls = LinkStatus { + enabled: u8_to_bool(c_nodestatus.link_status[i].enabled), + connected: u8_to_bool(c_nodestatus.link_status[i].connected), + dynconnected: u8_to_bool(c_nodestatus.link_status[i].dynconnected), + mtu: c_nodestatus.link_status[i].mtu, + src_ipaddr: string_from_bytes(&c_nodestatus.link_status[i].src_ipaddr[0], CFG_MAX_HOST_LEN)?, + dst_ipaddr: string_from_bytes(&c_nodestatus.link_status[i].dst_ipaddr[0], CFG_MAX_HOST_LEN)?, + }; + ns.link_status.push(ls); + } + + Ok(ns) +} + +// Constructor for link status to make c_ndostatus initialization tidier. +fn new_ls() -> ffi::corosync_knet_link_status_v1 +{ + ffi::corosync_knet_link_status_v1 { + enabled:0, + connected:0, + dynconnected:0, + mtu:0, + src_ipaddr: [0; 256], + dst_ipaddr: [0; 256], + } +} + +/// Get the extended status of a node in the cluster (including active links) from its [NodeId]. +/// Returns a filled in [NodeStatus] struct +pub fn node_status_get(handle: Handle, nodeid: NodeId, _version: NodeStatusVersion) -> Result +{ + // Currently only supports V1 struct + unsafe { + // We need to initialize this even though it's all going to be overwritten. + let mut c_nodestatus = ffi::corosync_cfg_node_status_v1 { + version: 1, + nodeid:0, + reachable:0, + remote:0, + external:0, + onwire_min:0, + onwire_max:0, + onwire_ver:0, + link_status: [new_ls(); 8], + }; + + let res = ffi::corosync_cfg_node_status_get(handle.cfg_handle, u32::from(nodeid), 1, &mut c_nodestatus as *mut _ as *mut c_void); + + if res == ffi::CS_OK { + unpack_nodestatus(c_nodestatus) + } else { + Err(CsError::from_c(res)) + } + } +} + +/// Start tracking for shutdown notifications +pub fn track_start(handle: Handle, _flags: TrackFlags) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_trackstart(handle.cfg_handle, 0) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Stop tracking for shutdown notifications +pub fn track_stop(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::corosync_cfg_trackstop(handle.cfg_handle) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/cmap.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/cmap.rs new file mode 100644 index 00000000..d1ee1706 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/cmap.rs @@ -0,0 +1,812 @@ +// libcmap interface for Rust +// Copyright (c) 2021 Red Hat, Inc. +// +// All rights reserved. +// +// Author: Christine Caulfield (ccaulfi@redhat.com) +// + + +// For the code generated by bindgen +use crate::sys::cmap as ffi; + +use std::os::raw::{c_void, c_int, c_char}; +use std::collections::HashMap; +use std::sync::Mutex; +use std::ffi::{CString}; +use num_enum::TryFromPrimitive; +use std::convert::TryFrom; +use std::ptr::copy_nonoverlapping; +use std::fmt; + +// NOTE: size_of and TypeId look perfect for this +// to make a generic set() function, but requre that the +// parameter too all functions is 'static, +// which we can't work with. +// Leaving this comment here in case that changes +//use core::mem::size_of; +//use std::any::TypeId; + +use crate::{CsError, DispatchFlags, Result}; +use crate::string_from_bytes; + +// Maps: +/// "Maps" available to [initialize] +pub enum Map +{ + Icmap, + Stats, +} + +bitflags! { +/// Tracker types for cmap, both passed into [track_add] +/// and returned from its callback. + pub struct TrackType: i32 + { + const DELETE = 1; + const MODIFY = 2; + const ADD = 4; + const PREFIX = 8; + } +} + +impl fmt::Display for TrackType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.contains(TrackType::DELETE) { + write!(f, "DELETE ")? + } + if self.contains(TrackType::MODIFY) { + write!(f, "MODIFY ")? + } + if self.contains(TrackType::ADD) { + write!(f, "ADD ")? + } + if self.contains(TrackType::PREFIX) { + write!(f, "PREFIX ") + } + else { + Ok(()) + } + } +} + +#[derive(Copy, Clone)] +/// A handle returned from [initialize], needs to be passed to all other cmap API calls +pub struct Handle +{ + cmap_handle: u64, +} + +#[derive(Copy, Clone)] +/// A handle for a specific CMAP tracker. returned from [track_add]. +/// There may be multiple TrackHandles per [Handle] +pub struct TrackHandle +{ + track_handle: u64, + notify_callback: NotifyCallback, +} + +// Used to convert CMAP handles into one of ours, for callbacks +lazy_static! { + static ref TRACKHANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); + static ref HANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); +} + +/// Initialize a connection to the cmap subsystem. +/// map specifies which cmap "map" to use. +/// Returns a [Handle] into the cmap library +pub fn initialize(map: Map) -> Result +{ + let mut handle: ffi::cmap_handle_t = 0; + let c_map = match map { + Map::Icmap => ffi::CMAP_MAP_ICMAP, + Map::Stats => ffi::CMAP_MAP_STATS, + }; + + unsafe { + let res = ffi::cmap_initialize_map(&mut handle, + c_map); + if res == ffi::CS_OK { + let rhandle = Handle{cmap_handle: handle}; + HANDLE_HASH.lock().unwrap().insert(handle, rhandle); + Ok(rhandle) + } else { + Err(CsError::from_c(res)) + } + } +} + + +/// Finish with a connection to corosync. +/// Takes a [Handle] as returned from [initialize] +pub fn finalize(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::cmap_finalize(handle.cmap_handle) + }; + if res == ffi::CS_OK { + HANDLE_HASH.lock().unwrap().remove(&handle.cmap_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Return a file descriptor to use for poll/select on the CMAP handle. +/// Takes a [Handle] as returned from [initialize], +/// returns a C file descriptor as i32 +pub fn fd_get(handle: Handle) -> Result +{ + let c_fd: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let res = + unsafe { + ffi::cmap_fd_get(handle.cmap_handle, c_fd) + }; + if res == ffi::CS_OK { + Ok(unsafe { *c_fd }) + } else { + Err(CsError::from_c(res)) + } +} + +/// Dispatch any/all active CMAP callbacks. +/// Takes a [Handle] as returned from [initialize], +/// flags [DispatchFlags] tells it how many items to dispatch before returning +pub fn dispatch(handle: Handle, flags: DispatchFlags) -> Result<()> +{ + let res = + unsafe { + ffi::cmap_dispatch(handle.cmap_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Get the current 'context' value for this handle +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source +pub fn context_get(handle: Handle) -> Result +{ + let (res, context) = + unsafe { + let mut context : u64 = 0; + let c_context: *mut c_void = &mut context as *mut _ as *mut c_void; + let r = ffi::cmap_context_get(handle.cmap_handle, c_context as *mut *const c_void); + (r, context) + }; + if res == ffi::CS_OK { + Ok(context) + } else { + Err(CsError::from_c(res)) + } +} + +/// Set the current 'context' value for this handle +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source. +/// Normally this is set in [initialize], but this allows it to be changed +pub fn context_set(handle: Handle, context: u64) -> Result<()> +{ + let res = + unsafe { + let c_context = context as *mut c_void; + ffi::cmap_context_set(handle.cmap_handle, c_context) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// The type of data returned from [get] or in a +/// tracker callback or iterator, part of the [Data] struct +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u32)] +pub enum DataType { + Int8 = ffi::CMAP_VALUETYPE_INT8 as u32, + UInt8 = ffi::CMAP_VALUETYPE_UINT8 as u32, + Int16 = ffi::CMAP_VALUETYPE_INT16 as u32, + UInt16 = ffi::CMAP_VALUETYPE_UINT16 as u32, + Int32 = ffi::CMAP_VALUETYPE_INT32 as u32, + UInt32 = ffi::CMAP_VALUETYPE_UINT32 as u32, + Int64 = ffi::CMAP_VALUETYPE_INT64 as u32, + UInt64 = ffi::CMAP_VALUETYPE_UINT64 as u32, + Float = ffi::CMAP_VALUETYPE_FLOAT as u32, + Double = ffi::CMAP_VALUETYPE_DOUBLE as u32, + String = ffi::CMAP_VALUETYPE_STRING as u32, + Binary = ffi::CMAP_VALUETYPE_BINARY as u32, + Unknown = 999, +} + +fn cmap_to_enum(cmap_type: u32) -> DataType +{ + match DataType::try_from(cmap_type) { + Ok(e) => e, + Err(_) => DataType::Unknown + } +} + +/// Data returned from the cmap::get() call and tracker & iterators. +/// Contains the data itself and the type of that data. +pub enum Data { + Int8(i8), + UInt8(u8), + Int16(i16), + UInt16(u16), + Int32(i32), + UInt32(u32), + Int64(i64), + UInt64(u64), + Float(f32), + Double(f64), + String(String), + Binary(Vec), + Unknown, +} + +impl fmt::Display for DataType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + DataType::Int8 => write!(f, "Int8"), + DataType::UInt8 => write!(f, "UInt8"), + DataType::Int16 => write!(f, "Int16"), + DataType::UInt16 => write!(f, "UInt16"), + DataType::Int32 => write!(f, "Int32"), + DataType::UInt32 => write!(f, "UInt32"), + DataType::Int64 => write!(f, "Int64"), + DataType::UInt64 => write!(f, "UInt64"), + DataType::Float => write!(f, "Float"), + DataType::Double => write!(f, "Double"), + DataType::String => write!(f, "String"), + DataType::Binary => write!(f, "Binary"), + DataType::Unknown => write!(f, "Unknown"), + } + } +} + +impl fmt::Display for Data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Data::Int8(v) => write!(f, "{} (Int8)", v), + Data::UInt8(v) => write!(f, "{} (UInt8)", v), + Data::Int16(v) => write!(f, "{} (Int16)", v), + Data::UInt16(v) => write!(f, "{} (UInt16)", v), + Data::Int32(v) => write!(f, "{} (Int32)", v), + Data::UInt32(v) => write!(f, "{} (UInt32)", v), + Data::Int64(v) => write!(f, "{} (Int64)", v), + Data::UInt64(v) => write!(f, "{} (UInt64)", v), + Data::Float(v) => write!(f, "{} (Float)", v), + Data::Double(v) => write!(f, "{} (Double)", v), + Data::String(v) => write!(f, "{} (String)", v), + Data::Binary(v) => write!(f, "{:?} (Binary)", v), + Data::Unknown => write!(f, "Unknown)"), + } + } +} + +const CMAP_KEYNAME_MAXLENGTH : usize = 255; +fn string_to_cstring_validated(key: &String, maxlen: usize) -> Result +{ + if maxlen > 0 && key.chars().count() >= maxlen { + return Err(CsError::CsErrInvalidParam); + } + + match CString::new(key.as_str()) { + Ok(n) => Ok(n), + Err(_) => Err(CsError::CsErrLibrary), + } +} + +fn set_value(handle: Handle, key_name: &String, datatype: DataType, value: *mut c_void, length: usize) -> Result<()> +{ + let csname = string_to_cstring_validated(&key_name, CMAP_KEYNAME_MAXLENGTH)?; + let res = unsafe { + ffi::cmap_set(handle.cmap_handle, csname.as_ptr(), value, length, datatype as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Sets a u8 value into cmap +// I wanted to make a generic for these but the Rust functions +// for getting a type in a generic function require the value +// to be 'static, sorry +pub fn set_u8(handle: Handle, key_name: &String, value: u8) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::UInt8, c_value as *mut c_void, 1) +} + +/// Sets an i8 value into cmap +pub fn set_i8(handle: Handle, key_name: &String, value: i8) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::Int8, c_value as *mut c_void, 1) +} + +/// Sets a u16 value into cmap +pub fn set_u16(handle: Handle, key_name: &String, value: u16) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::UInt16, c_value as *mut c_void, 2) +} + +/// Sets an i16 value into cmap +pub fn set_i16(handle: Handle, key_name: &String, value: i16) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::Int16, c_value as *mut c_void, 2) +} + +/// Sets a u32 value into cmap +pub fn set_u32(handle: Handle, key_name: &String, value: u32) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::UInt32, c_value, 4) +} + +/// Sets an i32 value into cmap +pub fn set_i132(handle: Handle, key_name: &String, value: i32) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::Int32, c_value as *mut c_void, 4) +} + +/// Sets a u64 value into cmap +pub fn set_u64(handle: Handle, key_name: &String, value: u64) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::UInt64, c_value as *mut c_void, 8) +} + +/// Sets an i64 value into cmap +pub fn set_i164(handle: Handle, key_name: &String, value: i64) -> Result<()> +{ + let mut tmp = value; + let c_value: *mut c_void = &mut tmp as *mut _ as *mut c_void; + set_value(handle, key_name, DataType::Int64, c_value as *mut c_void, 8) +} + +/// Sets a string value into cmap +pub fn set_string(handle: Handle, key_name: &String, value: &String) -> Result<()> +{ + let v_string = string_to_cstring_validated(&value, 0)?; + set_value(handle, key_name, DataType::String, v_string.as_ptr() as *mut c_void, value.chars().count()) +} + +/// Sets a binary value into cmap +pub fn set_binary(handle: Handle, key_name: &String, value: &[u8]) -> Result<()> +{ + set_value(handle, key_name, DataType::Binary, value.as_ptr() as *mut c_void, value.len()) +} + +/// Sets a [Data] type into cmap +pub fn set(handle: Handle, key_name: &String, data: &Data) ->Result<()> +{ + let (datatype, datalen, c_value) = match data { + Data::Int8(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Int8, 1, cv) + }, + Data::UInt8(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::UInt8, 1, cv) + }, + Data::Int16(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Int16, 2, cv) + }, + Data::UInt16(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::UInt8, 2, cv) + }, + Data::Int32(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Int32, 4, cv) + }, + Data::UInt32(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::UInt32, 4, cv) + }, + Data::Int64(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Int64, 8, cv) + }, + Data::UInt64(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::UInt64, 8, cv) + }, + Data::Float(v)=> { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Float, 4, cv) + }, + Data::Double(v) => { + let mut tmp = *v; + let cv: *mut c_void = &mut tmp as *mut _ as *mut c_void; + (DataType::Double, 8, cv) + }, + Data::String(v) => { + let cv = string_to_cstring_validated(v, 0)?; + // Can't let cv go out of scope + return set_value(handle, key_name, DataType::String, cv.as_ptr() as * mut c_void, v.chars().count()); + }, + Data::Binary(v) => { + // Vec doesn't return quite the right types. + return set_value(handle, key_name, DataType::Binary, v.as_ptr() as *mut c_void, v.len()); + }, + Data::Unknown => return Err(CsError::CsErrInvalidParam) + }; + + set_value(handle, key_name, datatype, c_value, datalen) +} + +// Local function to parse out values from the C mess +// Assumes the c_value is complete. So cmap::get() will need to check the size +// and re-get before calling us with a resized buffer +fn c_to_data(value_size: usize, c_key_type: u32, c_value: *const u8) -> Result +{ + unsafe { + match cmap_to_enum(c_key_type) { + DataType::UInt8 => { + let mut ints = [0u8; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::UInt8(ints[0])) + } + DataType::Int8 => { + let mut ints = [0i8; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Int8(ints[0])) + } + DataType::UInt16 => { + let mut ints = [0u16; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::UInt16(ints[0])) + } + DataType::Int16 => { + let mut ints = [0i16; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Int16(ints[0])) + } + DataType::UInt32 => { + let mut ints = [0u32; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::UInt32(ints[0])) + } + DataType::Int32 => { + let mut ints = [0i32; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Int32(ints[0])) + } + DataType::UInt64 => { + let mut ints = [0u64; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::UInt64(ints[0])) + } + DataType::Int64 => { + let mut ints = [0i64; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Int64(ints[0])) + } + DataType::Float => { + let mut ints = [0f32; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Float(ints[0])) + } + DataType::Double => { + let mut ints = [0f64; 1]; + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Double(ints[0])) + } + DataType::String => { + let mut ints = Vec::::new(); + ints.resize(value_size, 0u8); + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + // -1 here so CString doesn't see the NUL + let cs = match CString::new(&ints[0..value_size-1 as usize]) { + Ok(c1) => c1, + Err(_) => return Err(CsError::CsErrLibrary), + }; + match cs.into_string() { + Ok(s) => Ok(Data::String(s)), + Err(_) => return Err(CsError::CsErrLibrary), + } + } + DataType::Binary => { + let mut ints = Vec::::new(); + ints.resize(value_size, 0u8); + copy_nonoverlapping(c_value as *mut u8, ints.as_mut_ptr() as *mut u8, value_size); + Ok(Data::Binary(ints)) + } + DataType::Unknown => { + Ok(Data::Unknown) + } + } + } +} + +const INITIAL_SIZE : usize = 256; + +/// Get a value from cmap, returned as a [Data] struct, so could be anything +pub fn get(handle: Handle, key_name: &String) -> Result +{ + let csname = string_to_cstring_validated(&key_name, CMAP_KEYNAME_MAXLENGTH)?; + let mut value_size : usize = 16; + let mut c_key_type : u32 = 0; + let mut c_value = Vec::::new(); + + // First guess at a size for Strings and Binaries. Expand if needed + c_value.resize(INITIAL_SIZE, 0u8); + + unsafe { + let res = ffi::cmap_get(handle.cmap_handle, csname.as_ptr(), c_value.as_mut_ptr() as *mut c_void, + &mut value_size, &mut c_key_type); + if res == ffi::CS_OK { + + if value_size > INITIAL_SIZE { + // Need to try again with a bigger buffer + c_value.resize(value_size, 0u8); + let res2 = ffi::cmap_get(handle.cmap_handle, csname.as_ptr(), c_value.as_mut_ptr() as *mut c_void, + &mut value_size, &mut c_key_type); + if res2 != ffi::CS_OK { + return Err(CsError::from_c(res2)); + } + } + + // Convert to Rust type and return as a Data enum + return c_to_data(value_size, c_key_type, c_value.as_ptr()); + } else { + return Err(CsError::from_c(res)); + } + } +} + +/// increment the value in a cmap key (must be a numeric type) +pub fn inc(handle: Handle, key_name: &String) -> Result<()> +{ + let csname = string_to_cstring_validated(&key_name, CMAP_KEYNAME_MAXLENGTH)?; + let res = unsafe { + ffi::cmap_inc(handle.cmap_handle, csname.as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// decrement the value in a cmap key (must be a numeric type) +pub fn dec(handle: Handle, key_name: &String) -> Result<()> +{ + let csname = string_to_cstring_validated(&key_name, CMAP_KEYNAME_MAXLENGTH)?; + let res = unsafe { + ffi::cmap_dec(handle.cmap_handle, csname.as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// Callback for CMAP notify events from corosync, convert params to Rust and pass on. +extern "C" fn rust_notify_fn(cmap_handle: ffi::cmap_handle_t, + cmap_track_handle: ffi::cmap_track_handle_t, + event: i32, + key_name: *const ::std::os::raw::c_char, + new_value: ffi::cmap_notify_value, + old_value: ffi::cmap_notify_value, + user_data: *mut ::std::os::raw::c_void) +{ + // If cmap_handle doesn't match then throw away the callback. + match HANDLE_HASH.lock().unwrap().get(&cmap_handle) { + Some(r_cmap_handle) => { + match TRACKHANDLE_HASH.lock().unwrap().get(&cmap_track_handle) { + Some(h) => { + let r_keyname = match string_from_bytes(key_name, CMAP_KEYNAME_MAXLENGTH) { + Ok(s) => s, + Err(_) => return, + }; + + let r_old = match c_to_data(old_value.len, old_value.type_, old_value.data as *const u8) { + Ok(v) => v, + Err(_) => return, + }; + let r_new = match c_to_data(new_value.len, new_value.type_, new_value.data as *const u8) { + Ok(v) => v, + Err(_) => return, + }; + + match h.notify_callback.notify_fn { + Some(cb) => + (cb)(r_cmap_handle, h, TrackType{bits: event}, + &r_keyname, + &r_old, &r_new, + user_data as u64), + None => {} + } + } + None => {} + } + } + None => {} + } +} + +/// Callback function called every time a tracker reports a change in a tracked value +#[derive(Copy, Clone)] +pub struct NotifyCallback +{ + pub notify_fn: Option, +} + +/// Track changes in cmap values, multiple [TrackHandle]s per [Handle] are allowed +pub fn track_add(handle: Handle, + key_name: &String, + track_type: TrackType, + notify_callback: &NotifyCallback, + user_data: u64) -> Result +{ + let c_name = string_to_cstring_validated(&key_name, CMAP_KEYNAME_MAXLENGTH)?; + let mut c_trackhandle = 0u64; + let res = + unsafe { + ffi::cmap_track_add(handle.cmap_handle, c_name.as_ptr(), track_type.bits, Some(rust_notify_fn), user_data as *mut c_void, &mut c_trackhandle) + }; + if res == ffi::CS_OK { + let rhandle = TrackHandle{track_handle: c_trackhandle, notify_callback: *notify_callback}; + TRACKHANDLE_HASH.lock().unwrap().insert(c_trackhandle, rhandle); + Ok(rhandle) + } else { + Err(CsError::from_c(res)) + } +} + +/// Remove a tracker frm this [Handle] +pub fn track_delete(handle: Handle, + track_handle: TrackHandle)->Result<()> +{ + let res = + unsafe { + ffi::cmap_track_delete(handle.cmap_handle, track_handle.track_handle) + }; + if res == ffi::CS_OK { + TRACKHANDLE_HASH.lock().unwrap().remove(&track_handle.track_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Create one of these to start iterating over cmap values. +pub struct CmapIterStart +{ + iter_handle: u64, + cmap_handle: u64, +} + +pub struct CmapIntoIter +{ + cmap_handle: u64, + iter_handle: u64, +} + +/// Value returned from the iterator. contains the key name and the [Data] +pub struct CmapIter +{ + key_name: String, + data: Data, +} + +impl fmt::Debug for CmapIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}: {}", self.key_name, self.data) + } +} + +impl Iterator for CmapIntoIter { + type Item = CmapIter; + + fn next(&mut self) -> Option { + let mut c_key_name = [0u8; CMAP_KEYNAME_MAXLENGTH+1]; + let mut c_value_len = 0usize; + let mut c_value_type = 0u32; + let res = unsafe { + ffi::cmap_iter_next(self.cmap_handle, self.iter_handle, + c_key_name.as_mut_ptr() as *mut c_char, + &mut c_value_len, &mut c_value_type) + }; + if res == ffi::CS_OK { + // Return the Data for this iteration + let mut c_value = Vec::::new(); + c_value.resize(c_value_len, 0u8); + let res = unsafe { + ffi::cmap_get(self.cmap_handle, c_key_name.as_ptr() as *mut c_char, c_value.as_mut_ptr() as *mut c_void, + &mut c_value_len, &mut c_value_type) + }; + if res == ffi::CS_OK { + match c_to_data(c_value_len, c_value_type, c_value.as_ptr()) { + Ok(d) => { + let r_keyname = match string_from_bytes(c_key_name.as_ptr() as *mut c_char, CMAP_KEYNAME_MAXLENGTH) { + Ok(s) => s, + Err(_) => return None, + }; + Some(CmapIter{key_name: r_keyname, data: d}) + } + Err(_) => None + } + } else { + // cmap_get returned error + None + } + } else if res == ffi::CS_ERR_NO_SECTIONS { // End of list + unsafe { + // Yeah, we don't check this return code. There's nowhere to report it. + ffi::cmap_iter_finalize(self.cmap_handle, self.iter_handle) + }; + None + } else { + None + } + } +} + + +impl CmapIterStart { + /// Create a new [CmapIterStart] object for iterating over a list of cmap keys + pub fn new(cmap_handle: Handle, prefix: &String) -> Result + { + let mut iter_handle : u64 = 0; + let res = + unsafe { + let c_prefix = string_to_cstring_validated(&prefix, CMAP_KEYNAME_MAXLENGTH)?; + ffi::cmap_iter_init(cmap_handle.cmap_handle, c_prefix.as_ptr(), &mut iter_handle) + }; + if res == ffi::CS_OK { + Ok(CmapIterStart{cmap_handle: cmap_handle.cmap_handle, iter_handle}) + } else { + Err(CsError::from_c(res)) + } + } +} + +impl IntoIterator for CmapIterStart { + type Item = CmapIter; + type IntoIter = CmapIntoIter; + + fn into_iter(self) -> Self::IntoIter + { + CmapIntoIter {iter_handle: self.iter_handle, cmap_handle: self.cmap_handle} + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs new file mode 100644 index 00000000..75fe13fe --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs @@ -0,0 +1,657 @@ +// libcpg interface for Rust +// Copyright (c) 2020 Red Hat, Inc. +// +// All rights reserved. +// +// Author: Christine Caulfield (ccaulfi@redhat.com) +// + + +// For the code generated by bindgen +use crate::sys::cpg as ffi; + +use std::collections::HashMap; +use std::os::raw::{c_void, c_int}; +use std::sync::Mutex; +use std::string::String; +use std::ffi::{CStr, c_char}; +use std::ptr::copy_nonoverlapping; +use std::slice; +use std::fmt; + +// General corosync things +use crate::{CsError, DispatchFlags, Result, NodeId}; +use crate::string_from_bytes; + +const CPG_NAMELEN_MAX: usize = 128; +const CPG_MEMBERS_MAX: usize = 128; + + +/// RingId returned by totem_confchg_fn +#[derive(Copy, Clone)] +pub struct RingId { + pub nodeid: NodeId, + pub seq: u64, +} + +/// Totem delivery guarantee options for [mcast_joined] +// The C enum doesn't have numbers in the code +// so don't assume we can match them +#[derive(Copy, Clone)] +pub enum Guarantee { + TypeUnordered, + TypeFifo, + TypeAgreed, + TypeSafe, +} + +// Convert internal to cpg.h values. +impl Guarantee { + pub fn to_c (&self) -> u32 { + match self { + Guarantee::TypeUnordered => ffi::CPG_TYPE_UNORDERED, + Guarantee::TypeFifo => ffi::CPG_TYPE_FIFO, + Guarantee::TypeAgreed => ffi::CPG_TYPE_AGREED, + Guarantee::TypeSafe => ffi::CPG_TYPE_SAFE, + } + } +} + + +/// Flow control state returned from [flow_control_state_get] +#[derive(Copy, Clone)] +pub enum FlowControlState { + Disabled, + Enabled +} + +/// No flags current specified for model1 so leave this at None +#[derive(Copy, Clone)] +pub enum Model1Flags { + None, +} + +/// Reason for cpg item callback +#[derive(Copy, Clone)] +pub enum Reason { + Undefined = 0, + Join = 1, + Leave = 2, + NodeDown = 3, + NodeUp = 4, + ProcDown = 5, +} + +// Convert to cpg.h values +impl Reason { + pub fn new(r: u32) ->Reason { + match r { + 0 => Reason::Undefined, + 1 => Reason::Join, + 2 => Reason::Leave, + 3 => Reason::NodeDown, + 4 => Reason::NodeUp, + 5 => Reason::ProcDown, + _ => Reason::Undefined + } + } +} +impl fmt::Display for Reason { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Reason::Undefined => write!(f, "Undefined"), + Reason::Join => write!(f, "Join"), + Reason::Leave => write!(f, "Leave"), + Reason::NodeDown => write!(f, "NodeDown"), + Reason::NodeUp => write!(f, "NodeUp"), + Reason::ProcDown => write!(f, "ProcDown"), + } + } +} + +/// A CPG address entry returned in the callbacks +pub struct Address { + pub nodeid: NodeId, + pub pid: u32, + pub reason: Reason, +} +impl fmt::Debug for Address { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "[nodeid: {}, pid: {}, reason: {}]", self.nodeid, self.pid, self.reason) + } +} + +/// Data for model1 [initialize] +#[derive(Copy, Clone)] +pub struct Model1Data { + pub flags: Model1Flags, + pub deliver_fn: Option, + pub confchg_fn: Option, + left_list: Vec
, + joined_list: Vec
, + )>, + pub totem_confchg_fn: Option, + )>, +} + +/// Modeldata for [initialize], only v1 supported at the moment +#[derive(Copy, Clone)] +pub enum ModelData { + ModelNone, + ModelV1 (Model1Data) +} + + +/// A handle into the cpg library. Returned from [initialize] and needed for all other calls +#[derive(Copy, Clone)] +pub struct Handle { + cpg_handle: u64, // Corosync library handle + model_data: ModelData, +} + +// Used to convert a CPG handle into one of ours +lazy_static! { + static ref HANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); +} + +// Convert a Rust String into a cpg_name struct for libcpg +fn string_to_cpg_name(group: &String) -> Result +{ + if group.len() > CPG_NAMELEN_MAX { + return Err(CsError::CsErrInvalidParam); + } + + let mut c_group = ffi::cpg_name { + length: group.len() as u32, + value: [0; CPG_NAMELEN_MAX] + }; + + unsafe { + // NOTE param order is 'wrong-way round' from C + copy_nonoverlapping(group.as_ptr() as *const c_char, c_group.value.as_mut_ptr(), group.len()); + } + + Ok(c_group) +} + + +// Convert an array of cpg_addresses to a Vec - used in callbacks +fn cpg_array_to_vec(list: *const ffi::cpg_address, list_entries: usize) -> Vec
+{ + let temp: &[ffi::cpg_address] = unsafe { slice::from_raw_parts(list, list_entries as usize) }; + let mut r_vec = Vec::
::new(); + + for i in 0..list_entries as usize { + let a: Address = Address {nodeid: NodeId::from(temp[i].nodeid), + pid: temp[i].pid, + reason: Reason::new(temp[i].reason)}; + r_vec.push(a); + } + r_vec +} + +// Called from CPG callback function - munge params back to Rust from C +extern "C" fn rust_deliver_fn( + handle: ffi::cpg_handle_t, + group_name: *const ffi::cpg_name, + nodeid: u32, + pid: u32, + msg: *mut ::std::os::raw::c_void, + msg_len: usize) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + // Convert group_name into a Rust str. + let r_group_name = unsafe { + CStr::from_ptr(&(*group_name).value[0]).to_string_lossy().into_owned() + }; + + let data : &[u8] = unsafe { + std::slice::from_raw_parts(msg as *const u8, msg_len) + }; + + match h.model_data { + ModelData::ModelV1(md) => + match md.deliver_fn { + Some(cb) => + (cb)(h, + r_group_name.to_string(), + NodeId::from(nodeid), + pid, + data, + msg_len), + None => {} + } + _ => {} + } + } + None => {} + } +} + +// Called from CPG callback function - munge params back to Rust from C +extern "C" fn rust_confchg_fn(handle: ffi::cpg_handle_t, + group_name: *const ffi::cpg_name, + member_list: *const ffi::cpg_address, + member_list_entries: usize, + left_list: *const ffi::cpg_address, + left_list_entries: usize, + joined_list: *const ffi::cpg_address, + joined_list_entries: usize) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_group_name = unsafe { + CStr::from_ptr(&(*group_name).value[0]).to_string_lossy().into_owned() + }; + let r_member_list = cpg_array_to_vec(member_list, member_list_entries); + let r_left_list = cpg_array_to_vec(left_list, left_list_entries); + let r_joined_list = cpg_array_to_vec(joined_list, joined_list_entries); + + match h.model_data { + ModelData::ModelV1(md) => { + match md.confchg_fn { + Some(cb) => + (cb)(h, + &r_group_name.to_string(), + r_member_list, + r_left_list, + r_joined_list), + None => {} + } + } + _ => {} + } + } + None => {} + } +} + +// Called from CPG callback function - munge params back to Rust from C +extern "C" fn rust_totem_confchg_fn(handle: ffi::cpg_handle_t, + ring_id: ffi::cpg_ring_id, + member_list_entries: u32, + member_list: *const u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_ring_id = RingId{nodeid: NodeId::from(ring_id.nodeid), + seq: ring_id.seq}; + let mut r_member_list = Vec::::new(); + let temp_members: &[u32] = unsafe { slice::from_raw_parts(member_list, member_list_entries as usize) }; + for i in 0..member_list_entries as usize { + r_member_list.push(NodeId::from(temp_members[i])); + } + + match h.model_data { + ModelData::ModelV1(md) => + match md.totem_confchg_fn { + Some(cb) => + (cb)(h, + r_ring_id, + r_member_list), + None => {} + } + _ => {} + } + } + None => {} + } +} + +/// Initialize a connection to the cpg library. You must call this before doing anything +/// else and use the passed back [Handle]. +/// Remember to free the handle using [finalize] when finished. +pub fn initialize(model_data: &ModelData, context: u64) -> Result +{ + let mut handle: ffi::cpg_handle_t = 0; + let mut m = match model_data { + ModelData::ModelV1(_v1) => { + ffi::cpg_model_v1_data_t { + model: ffi::CPG_MODEL_V1, + cpg_deliver_fn: Some(rust_deliver_fn), + cpg_confchg_fn: Some(rust_confchg_fn), + cpg_totem_confchg_fn: Some(rust_totem_confchg_fn), + flags: 0, // No supported flags (yet) + } + } + _ => return Err(CsError::CsErrInvalidParam) + }; + + unsafe { + let c_context: *mut c_void = &mut &context as *mut _ as *mut c_void; + let c_model: *mut ffi::cpg_model_data_t = &mut m as *mut _ as *mut ffi::cpg_model_data_t; + let res = ffi::cpg_model_initialize(&mut handle, + m.model, + c_model, + c_context); + + if res == ffi::CS_OK { + let rhandle = Handle{cpg_handle: handle, model_data: *model_data}; + HANDLE_HASH.lock().unwrap().insert(handle, rhandle); + Ok(rhandle) + } else { + Err(CsError::from_c(res)) + } + } +} + +/// Finish with a connection to corosync +pub fn finalize(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::cpg_finalize(handle.cpg_handle) + }; + if res == ffi::CS_OK { + HANDLE_HASH.lock().unwrap().remove(&handle.cpg_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// Not sure if an FD is the right thing to return here, but it will do for now. +/// Returns a file descriptor to use for poll/select on the CPG handle +pub fn fd_get(handle: Handle) -> Result +{ + let c_fd: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let res = + unsafe { + ffi::cpg_fd_get(handle.cpg_handle, c_fd) + }; + if res == ffi::CS_OK { + Ok(unsafe { *c_fd }) + } else { + Err(CsError::from_c(res)) + } +} + +/// Call any/all active CPG callbacks for this [Handle] see [DispatchFlags] for details +pub fn dispatch(handle: Handle, flags: DispatchFlags) -> Result<()> +{ + let res = + unsafe { + ffi::cpg_dispatch(handle.cpg_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Joins a CPG group for sending and receiving messages +pub fn join(handle: Handle, group: &String) -> Result<()> +{ + let res = + unsafe { + let c_group = string_to_cpg_name(group)?; + ffi::cpg_join(handle.cpg_handle, &c_group) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Leave the currently joined CPG group, another group can now be joined on +/// the same [Handle] or [finalize] can be called to finish using CPG +pub fn leave(handle: Handle, group: &String) -> Result<()> +{ + let res = + unsafe { + let c_group = string_to_cpg_name(group)?; + ffi::cpg_leave(handle.cpg_handle, &c_group) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the local node ID +pub fn local_get(handle: Handle) -> Result +{ + let mut nodeid: u32 = 0; + let res = + unsafe { + ffi::cpg_local_get(handle.cpg_handle, &mut nodeid) + }; + if res == ffi::CS_OK { + Ok(NodeId::from(nodeid)) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get a list of members of a CPG group as a vector of [Address] structs +pub fn membership_get(handle: Handle, group: &String) -> Result> +{ + let mut member_list_entries: i32 = 0; + let member_list = [ffi::cpg_address{nodeid:0, pid:0, reason:0}; CPG_MEMBERS_MAX]; + let res = + unsafe { + let mut c_group = string_to_cpg_name(group)?; + let c_memlist = member_list.as_ptr() as *mut ffi::cpg_address; + ffi::cpg_membership_get(handle.cpg_handle, &mut c_group, + &mut *c_memlist, + &mut member_list_entries) + }; + if res == ffi::CS_OK { + Ok(cpg_array_to_vec(member_list.as_ptr(), member_list_entries as usize)) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the maximum size that CPG can send in one corosync message, +/// any messages sent via [mcast_joined] that are larger than this +/// will be fragmented +pub fn max_atomic_msgsize_get(handle: Handle) -> Result +{ + let mut asize: u32 = 0; + let res = + unsafe { + ffi::cpg_max_atomic_msgsize_get(handle.cpg_handle, &mut asize) + }; + if res == ffi::CS_OK { + Ok(asize) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source +pub fn context_get(handle: Handle) -> Result +{ + let mut c_context: *mut c_void = &mut 0u64 as *mut _ as *mut c_void; + let (res, context) = + unsafe { + let r = ffi::cpg_context_get(handle.cpg_handle, &mut c_context); + let context: u64 = c_context as u64; + (r, context) + }; + if res == ffi::CS_OK { + Ok(context) + } else { + Err(CsError::from_c(res)) + } +} + +/// Set the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source. +/// Normally this is set in [initialize], but this allows it to be changed +pub fn context_set(handle: Handle, context: u64) -> Result<()> +{ + let res = + unsafe { + let c_context = context as *mut c_void; + ffi::cpg_context_set(handle.cpg_handle, c_context) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the flow control state of corosync CPG +pub fn flow_control_state_get(handle: Handle) -> Result +{ + let mut fc_state: u32 = 0; + let res = + unsafe { + ffi::cpg_flow_control_state_get(handle.cpg_handle, &mut fc_state) + }; + if res == ffi::CS_OK { + if fc_state == 1 { + Ok(true) + } else { + Ok(false) + } + } else { + Err(CsError::from_c(res)) + } +} + +/// Send a message to the currently joined CPG group +pub fn mcast_joined(handle: Handle, guarantee: Guarantee, + msg: &[u8]) -> Result<()> +{ + let c_iovec = ffi::iovec { + iov_base: msg.as_ptr() as *mut c_void, + iov_len: msg.len(), + }; + let res = + unsafe { + ffi::cpg_mcast_joined(handle.cpg_handle, + guarantee.to_c(), + &c_iovec, 1) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Type of iteration for [CpgIterStart] +#[derive(Copy, Clone)] +pub enum CpgIterType +{ + NameOnly = 1, + OneGroup = 2, + All = 3, +} + +// Iterator based on information on this page. thank you! +// https://stackoverflow.com/questions/30218886/how-to-implement-iterator-and-intoiterator-for-a-simple-struct +// Object to iterate over +/// An object to iterate over a list of CPG groups, create one of these and then use 'for' over it +pub struct CpgIterStart +{ + iter_handle: u64, +} + +/// struct returned from iterating over a [CpgIterStart] +pub struct CpgIter +{ + pub group: String, + pub nodeid: NodeId, + pub pid: u32, +} + +pub struct CpgIntoIter +{ + iter_handle: u64, +} + +impl fmt::Debug for CpgIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "[group: {}, nodeid: {}, pid: {}]", self.group, self.nodeid, self.pid) + } +} + +impl Iterator for CpgIntoIter { + type Item = CpgIter; + + fn next(&mut self) -> Option { + let mut c_iter_description = ffi::cpg_iteration_description_t { + nodeid: 0, pid: 0, + group: ffi::cpg_name{length: 0 as u32, value: [0; CPG_NAMELEN_MAX]}}; + let res = unsafe { + ffi::cpg_iteration_next(self.iter_handle, &mut c_iter_description) + }; + + if res == ffi::CS_OK { + let r_group = match string_from_bytes(c_iter_description.group.value.as_ptr(), CPG_NAMELEN_MAX) { + Ok(groupname) => groupname, + Err(_) => return None, + }; + Some(CpgIter{ + group: r_group, + nodeid: NodeId::from(c_iter_description.nodeid), + pid: c_iter_description.pid}) + } else if res == ffi::CS_ERR_NO_SECTIONS { // End of list + unsafe { + // Yeah, we don't check this return code. There's nowhere to report it. + ffi::cpg_iteration_finalize(self.iter_handle) + }; + None + } else { + None + } + } +} + +impl CpgIterStart { + /// Create a new [CpgIterStart] object for iterating over a list of active CPG groups + pub fn new(cpg_handle: Handle, group: &String, iter_type: CpgIterType) -> Result + { + let mut iter_handle : u64 = 0; + let res = + unsafe { + let mut c_group = string_to_cpg_name(group)?; + let c_itertype = iter_type as u32; + // IterType 'All' requires that the group pointer is passed in as NULL + let c_group_ptr = { + match iter_type { + CpgIterType::All => std::ptr::null_mut(), + _ => &mut c_group, + } + }; + ffi::cpg_iteration_initialize(cpg_handle.cpg_handle, c_itertype, c_group_ptr, &mut iter_handle) + }; + if res == ffi::CS_OK { + Ok(CpgIterStart{iter_handle}) + } else { + Err(CsError::from_c(res)) + } + } +} + +impl IntoIterator for CpgIterStart { + type Item = CpgIter; + type IntoIter = CpgIntoIter; + + fn into_iter(self) -> Self::IntoIter + { + CpgIntoIter {iter_handle: self.iter_handle} + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs new file mode 100644 index 00000000..eedf305a --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs @@ -0,0 +1,297 @@ +//! This crate provides access to the corosync libraries cpg, cfg, cmap, quorum & votequorum +//! from Rust. They are a fairly thin layer around the actual API calls but with Rust data types +//! and iterators. +//! +//! Corosync is a low-level provider of cluster services for high-availability clusters, +//! for more information about corosync see https://corosync.github.io/corosync/ +//! +//! No more information about corosync itself will be provided here, it is expected that if +//! you feel you need access to the Corosync API calls, you know what they do :) +//! +//! # Example +//! ``` +//! extern crate rust_corosync as corosync; +//! use corosync::cmap; +//! +//! fn main() +//! { +//! // Open connection to corosync libcmap +//! let handle = +//! match cmap::initialize(cmap::Map::Icmap) { +//! Ok(h) => { +//! println!("cmap initialized."); +//! h +//! } +//! Err(e) => { +//! println!("Error in CMAP (Icmap) init: {}", e); +//! return; +//! } +//! }; +//! +//! // Set a value +//! match cmap::set_u32(handle, &"test.test_uint32".to_string(), 456) +//! { +//! Ok(_) => {} +//! Err(e) => { +//! println!("Error in CMAP set_u32: {}", e); +//! return; +//! } +//! }; +//! +//! // Get a value - this will be a Data struct +//! match cmap::get(handle, &"test.test_uint32".to_string()) +//! { +//! Ok(v) => { +//! println!("GOT value {}", v); +//! } +//! Err(e) => { +//! println!("Error in CMAP get: {}", e); +//! return; +//! } +//! }; +//! +//! // Use an iterator +//! match cmap::CmapIterStart::new(handle, &"totem.".to_string()) { +//! Ok(cmap_iter) => { +//! for i in cmap_iter { +//! println!("ITER: {:?}", i); +//! } +//! println!(""); +//! } +//! Err(e) => { +//! println!("Error in CMAP iter start: {}", e); +//! } +//! } +//! +//! // Close this connection +//! match cmap::finalize(handle) +//! { +//! Ok(_) => {} +//! Err(e) => { +//! println!("Error in CMAP get: {}", e); +//! return; +//! } +//! }; +//! } + +#[macro_use] +extern crate lazy_static; +#[macro_use] +extern crate bitflags; + +/// cpg is the Control Process Groups subsystem of corosync and is usually used for sending +/// messages around the cluster. All processes using CPG belong to a named group (whose members +/// they can query) and all messages are sent with delivery guarantees. +pub mod cpg; +/// Quorum provides basic information about the quorate state of the cluster with callbacks +/// when nodelists change. +pub mod quorum; +///votequorum is the main quorum provider for corosync, using this API, users can query the state +/// of nodes in the cluster, request callbacks when the nodelists change, and set up a quorum device. +pub mod votequorum; +/// cfg is the internal configuration and information library for corosync, it is +/// mainly used by internal tools but may also contain API calls useful to some applications +/// that need detailed information about or control of the operation of corosync and the cluster. +pub mod cfg; +/// cmap is the internal 'database' of corosync - though it is NOT replicated. Mostly it contains +/// a copy of the corosync.conf file and information about the running state of the daemon. +/// The cmap API provides two 'maps'. Icmap, which is as above, and Stats, which contains very detailed +/// statistics on the running system, this includes network and IPC calls. +pub mod cmap; + +mod sys; + +use std::fmt; +use num_enum::TryFromPrimitive; +use std::convert::TryFrom; +use std::ptr::copy_nonoverlapping; +use std::ffi::CString; +use std::error::Error; + +// This needs to be kept up-to-date! +/// Error codes returned from the corosync libraries +#[derive(Debug, Eq, PartialEq, Copy, Clone, TryFromPrimitive)] +#[repr(u32)] +pub enum CsError { + CsOk = 1, + CsErrLibrary = 2, + CsErrVersion = 3, + CsErrInit = 4, + CsErrTimeout = 5, + CsErrTryAgain = 6, + CsErrInvalidParam = 7, + CsErrNoMemory = 8, + CsErrBadHandle = 9, + CsErrBusy = 10, + CsErrAccess = 11, + CsErrNotExist = 12, + CsErrNameTooLong = 13, + CsErrExist = 14, + CsErrNoSpace = 15, + CsErrInterrupt = 16, + CsErrNameNotFound = 17, + CsErrNoResources = 18, + CsErrNotSupported = 19, + CsErrBadOperation = 20, + CsErrFailedOperation = 21, + CsErrMessageError = 22, + CsErrQueueFull = 23, + CsErrQueueNotAvailable = 24, + CsErrBadFlags = 25, + CsErrTooBig = 26, + CsErrNoSection = 27, + CsErrContextNotFound = 28, + CsErrTooManyGroups = 30, + CsErrSecurity = 100, +#[num_enum(default)] + CsErrRustCompat = 998, // Set if we get a unknown return from corosync + CsErrRustString = 999, // Set if we get a string conversion error +} + +/// Result type returned from most corosync library calls. +/// Contains a [CsError] and possibly other data as required +pub type Result = ::std::result::Result; + +impl fmt::Display for CsError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + CsError::CsOk => write!(f, "OK"), + CsError::CsErrLibrary => write!(f, "ErrLibrary"), + CsError::CsErrVersion => write!(f, "ErrVersion"), + CsError::CsErrInit => write!(f, "ErrInit"), + CsError::CsErrTimeout => write!(f, "ErrTimeout"), + CsError::CsErrTryAgain => write!(f, "ErrTryAgain"), + CsError::CsErrInvalidParam => write!(f, "ErrInvalidParam"), + CsError::CsErrNoMemory => write!(f, "ErrNoMemory"), + CsError::CsErrBadHandle => write!(f, "ErrbadHandle"), + CsError::CsErrBusy => write!(f, "ErrBusy"), + CsError::CsErrAccess => write!(f, "ErrAccess"), + CsError::CsErrNotExist => write!(f, "ErrNotExist"), + CsError::CsErrNameTooLong => write!(f, "ErrNameTooLong"), + CsError::CsErrExist => write!(f, "ErrExist"), + CsError::CsErrNoSpace => write!(f, "ErrNoSpace"), + CsError::CsErrInterrupt => write!(f, "ErrInterrupt"), + CsError::CsErrNameNotFound => write!(f, "ErrNameNotFound"), + CsError::CsErrNoResources => write!(f, "ErrNoResources"), + CsError::CsErrNotSupported => write!(f, "ErrNotSupported"), + CsError::CsErrBadOperation => write!(f, "ErrBadOperation"), + CsError::CsErrFailedOperation => write!(f, "ErrFailedOperation"), + CsError::CsErrMessageError => write!(f, "ErrMEssageError"), + CsError::CsErrQueueFull => write!(f, "ErrQueueFull"), + CsError::CsErrQueueNotAvailable => write!(f, "ErrQueueNotAvailable"), + CsError::CsErrBadFlags => write!(f, "ErrBadFlags"), + CsError::CsErrTooBig => write!(f, "ErrTooBig"), + CsError::CsErrNoSection => write!(f, "ErrNoSection"), + CsError::CsErrContextNotFound => write!(f, "ErrContextNotFound"), + CsError::CsErrTooManyGroups => write!(f, "ErrTooManyGroups"), + CsError::CsErrSecurity => write!(f, "ErrSecurity"), + CsError::CsErrRustCompat => write!(f, "ErrRustCompat"), + CsError::CsErrRustString => write!(f, "ErrRustString"), + } + } +} + +impl Error for CsError {} + +// This is dependant on the num_enum crate, converts a C cs_error_t into the Rust enum +// There seems to be some debate as to whether this should be part of the language: +// https://internals.rust-lang.org/t/pre-rfc-enum-from-integer/6348/25 +impl CsError { + fn from_c(cserr: u32) -> CsError + { + match CsError::try_from(cserr) { + Ok(e) => e, + Err(_) => CsError::CsErrRustCompat + } + } +} + + +/// Flags to use with dispatch functions, eg [cpg::dispatch] +/// One will dispatch a single callback (blocking) and return. +/// All will loop trying to dispatch all possible callbacks. +/// Blocking is like All but will block between callbacks. +/// OneNonBlocking will dispatch a single callback only if one is available, +/// otherwise it will return even if no callback is available. +#[derive(Copy, Clone)] +// The numbers match the C enum, of course. +pub enum DispatchFlags { + One = 1, + All = 2, + Blocking = 3, + OneNonblocking = 4, +} + +/// Flags to use with (most) tracking API calls +#[derive(Copy, Clone)] +// Same here +pub enum TrackFlags { + Current = 1, + Changes = 2, + ChangesOnly = 4, +} + +/// A corosync nodeid +#[derive(Copy, Clone, Debug)] +pub struct NodeId { + id: u32, +} + +impl fmt::Display for NodeId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.id) + } +} + +// Conversion from a NodeId to and from u32 +impl From for NodeId { + fn from(id: u32) -> NodeId { + NodeId{id} + } +} + +impl From for u32 { + fn from(nodeid: NodeId) -> u32 { + nodeid.id + } +} + + +// General internal routine to copy bytes from a C array into a Rust String +fn string_from_bytes(bytes: *const ::std::os::raw::c_char, max_length: usize) -> Result +{ + let mut newbytes = Vec::::new(); + newbytes.resize(max_length, 0u8); + + unsafe { + // We need to fully copy it, not shallow copy it. + // Messy casting on both parts of the copy here to get it to work on both signed + // and unsigned char machines + copy_nonoverlapping(bytes as *mut i8, newbytes.as_mut_ptr() as *mut i8, max_length); + } + + // Get length of the string in old-fashioned style + let mut length: usize = 0; + let mut count : usize = 0; + for i in &newbytes { + if *i == 0 && length == 0 { + length = count; + break; + } + count += 1; + } + + // Cope with an empty string + if length == 0 { + return Ok(String::new()); + } + + let cs = match CString::new(&newbytes[0..length as usize]) { + Ok(c1) => c1, + Err(_) => return Err(CsError::CsErrRustString), + }; + match cs.into_string() { + Ok(s) => Ok(s), + Err(_) => Err(CsError::CsErrRustString), + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/quorum.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/quorum.rs new file mode 100644 index 00000000..0d61c9ac --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/quorum.rs @@ -0,0 +1,337 @@ +// libquorum interface for Rust +// Copyright (c) 2021 Red Hat, Inc. +// +// All rights reserved. +// +// Author: Christine Caulfield (ccaulfi@redhat.com) +// + + +// For the code generated by bindgen +use crate::sys::quorum as ffi; + +use std::os::raw::{c_void, c_int}; +use std::slice; +use std::collections::HashMap; +use std::sync::Mutex; +use crate::{CsError, DispatchFlags, TrackFlags, Result, NodeId}; + +/// Data for model1 [initialize] +#[derive(Copy, Clone)] +pub enum ModelData { + ModelNone, + ModelV1 (Model1Data) +} + +/// Value returned from [initialize]. Indicates whether quorum is currently active on this cluster. +pub enum QuorumType { + Free, + Set +} + +/// Flags for [initialize], none currently supported +#[derive(Copy, Clone)] +pub enum Model1Flags { + None, +} + +/// RingId returned in quorum_notification_fn +pub struct RingId { + pub nodeid: NodeId, + pub seq: u64, +} + +// Used to convert a QUORUM handle into one of ours +lazy_static! { + static ref HANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); +} + +fn list_to_vec(list_entries: u32, list: *const u32) -> Vec +{ + let mut r_member_list = Vec::::new(); + let temp_members: &[u32] = unsafe { slice::from_raw_parts(list, list_entries as usize) }; + for i in 0..list_entries as usize { + r_member_list.push(NodeId::from(temp_members[i])); + } + r_member_list +} + + +// Called from quorum callback function - munge params back to Rust from C +extern "C" fn rust_quorum_notification_fn( + handle: ffi::quorum_handle_t, + quorate: u32, + ring_id: ffi::quorum_ring_id, + member_list_entries: u32, + member_list: *const u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_ring_id = RingId{nodeid: NodeId::from(ring_id.nodeid), + seq: ring_id.seq}; + let r_member_list = list_to_vec(member_list_entries, member_list); + let r_quorate = match quorate { + 0 => false, + 1 => true, + _ => false, + }; + match &h.model_data { + ModelData::ModelV1(md) => + match md.quorum_notification_fn { + Some(cb) => + (cb)(h, + r_quorate, + r_ring_id, + r_member_list), + None => {} + } + _ => {} + } + } + None => {} + } + +} + + +extern "C" fn rust_nodelist_notification_fn( + handle: ffi::quorum_handle_t, + ring_id: ffi::quorum_ring_id, + member_list_entries: u32, + member_list: *const u32, + joined_list_entries: u32, + joined_list: *const u32, + left_list_entries: u32, + left_list: *const u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_ring_id = RingId{nodeid: NodeId::from(ring_id.nodeid), + seq: ring_id.seq}; + + let r_member_list = list_to_vec(member_list_entries, member_list); + let r_joined_list = list_to_vec(joined_list_entries, joined_list); + let r_left_list = list_to_vec(left_list_entries, left_list); + + match &h.model_data { + ModelData::ModelV1(md) => + match md.nodelist_notification_fn { + Some(cb) => + (cb)(h, + r_ring_id, + r_member_list, + r_joined_list, + r_left_list), + None => {} + } + _ => {} + } + } + None => {} + } + +} + +#[derive(Copy, Clone)] +/// Data for model1 [initialize] +pub struct Model1Data { + pub flags: Model1Flags, + pub quorum_notification_fn: Option)>, + pub nodelist_notification_fn: Option, + joined_list: Vec, + left_list: Vec)>, +} + +/// A handle into the quorum library. Returned from [initialize] and needed for all other calls +#[derive(Copy, Clone)] +pub struct Handle { + quorum_handle: u64, + model_data: ModelData, +} + + +/// Initialize a connection to the quorum library. You must call this before doing anything +/// else and use the passed back [Handle]. +/// Remember to free the handle using [finalize] when finished. +pub fn initialize(model_data: &ModelData, context: u64) -> Result<(Handle, QuorumType)> +{ + let mut handle: ffi::quorum_handle_t = 0; + let mut quorum_type: u32 = 0; + + let mut m = match model_data { + ModelData::ModelV1(_v1) => { + ffi::quorum_model_v1_data_t { + model: ffi::QUORUM_MODEL_V1, + quorum_notify_fn: Some(rust_quorum_notification_fn), + nodelist_notify_fn: Some(rust_nodelist_notification_fn), + } + } + // Only V1 supported. No point in doing legacy stuff in a new binding + _ => return Err(CsError::CsErrInvalidParam) + }; + + handle = + unsafe { + let c_context: *mut c_void = &mut &context as *mut _ as *mut c_void; + let c_model: *mut ffi::quorum_model_data_t = &mut m as *mut _ as *mut ffi::quorum_model_data_t; + let res = ffi::quorum_model_initialize(&mut handle, + m.model, + c_model, + &mut quorum_type, + c_context); + + if res == ffi::CS_OK { + handle + } else { + return Err(CsError::from_c(res)) + } + }; + + let quorum_type = + match quorum_type { + 0 => QuorumType::Free, + 1 => QuorumType::Set, + _ => QuorumType::Set, + }; + let rhandle = Handle{quorum_handle: handle, model_data: *model_data}; + HANDLE_HASH.lock().unwrap().insert(handle, rhandle); + Ok((rhandle, quorum_type)) +} + + +/// Finish with a connection to corosync +pub fn finalize(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::quorum_finalize(handle.quorum_handle) + }; + if res == ffi::CS_OK { + HANDLE_HASH.lock().unwrap().remove(&handle.quorum_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// Not sure if an FD is the right thing to return here, but it will do for now. +/// Return a file descriptor to use for poll/select on the QUORUM handle +pub fn fd_get(handle: Handle) -> Result +{ + let c_fd: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let res = + unsafe { + ffi::quorum_fd_get(handle.quorum_handle, c_fd) + }; + if res == ffi::CS_OK { + Ok(unsafe { *c_fd }) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Display any/all active QUORUM callbacks for this [Handle], see [DispatchFlags] for details +pub fn dispatch(handle: Handle, flags: DispatchFlags) -> Result<()> +{ + let res = + unsafe { + ffi::quorum_dispatch(handle.quorum_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Return the quorate status of the cluster +pub fn getquorate(handle: Handle) -> Result +{ + let c_quorate: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let (res, r_quorate) = + unsafe { + let res = ffi::quorum_getquorate(handle.quorum_handle, c_quorate); + let r_quorate : i32 = *c_quorate; + (res, r_quorate) + }; + if res == ffi::CS_OK { + match r_quorate { + 0 => Ok(false), + 1 => Ok(true), + _ => Err(CsError::CsErrLibrary), + } + } else { + Err(CsError::from_c(res)) + } +} + +/// Track node and quorum changes +pub fn trackstart(handle: Handle, flags: TrackFlags) -> Result<()> +{ + let res = + unsafe { + ffi::quorum_trackstart(handle.quorum_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Stop tracking node and quorum changes +pub fn trackstop(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::quorum_trackstop(handle.quorum_handle) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source +pub fn context_get(handle: Handle) -> Result +{ + let (res, context) = + unsafe { + let mut context : u64 = 0; + let c_context: *mut c_void = &mut context as *mut _ as *mut c_void; + let r = ffi::quorum_context_get(handle.quorum_handle, c_context as *mut *const c_void); + (r, context) + }; + if res == ffi::CS_OK { + Ok(context) + } else { + Err(CsError::from_c(res)) + } +} + +/// Set the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source. +/// Normally this is set in [initialize], but this allows it to be changed +pub fn context_set(handle: Handle, context: u64) -> Result<()> +{ + let res = + unsafe { + let c_context = context as *mut c_void; + ffi::quorum_context_set(handle.quorum_handle, c_context) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cfg.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cfg.rs new file mode 100644 index 00000000..1b35747f --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cfg.rs @@ -0,0 +1,1239 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: usize, +} +pub type u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type pid_t = __pid_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type clock_t = __clock_t; +pub type clockid_t = __clockid_t; +pub type time_t = __time_t; +pub type timer_t = __timer_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +pub type sigset_t = __sigset_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +pub type suseconds_t = __suseconds_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __bindgen_anon_1: __pthread_cond_s__bindgen_ty_1, + pub __bindgen_anon_2: __pthread_cond_s__bindgen_ty_2, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_1 { + pub __wseq: ::std::os::raw::c_ulonglong, + pub __wseq32: __pthread_cond_s__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_1__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_2 { + pub __g1_start: ::std::os::raw::c_ulonglong, + pub __g1_start32: __pthread_cond_s__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_2__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 5usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, + _bindgen_union_align: [u64; 6usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: u64, +} +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +pub type socklen_t = __socklen_t; +pub const SOCK_STREAM: __socket_type = 1; +pub const SOCK_DGRAM: __socket_type = 2; +pub const SOCK_RAW: __socket_type = 3; +pub const SOCK_RDM: __socket_type = 4; +pub const SOCK_SEQPACKET: __socket_type = 5; +pub const SOCK_DCCP: __socket_type = 6; +pub const SOCK_PACKET: __socket_type = 10; +pub const SOCK_CLOEXEC: __socket_type = 524288; +pub const SOCK_NONBLOCK: __socket_type = 2048; +pub type __socket_type = ::std::os::raw::c_uint; +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: sa_family_t, + pub __ss_padding: [::std::os::raw::c_char; 118usize], + pub __ss_align: ::std::os::raw::c_ulong, +} +pub const MSG_OOB: ::std::os::raw::c_uint = 1; +pub const MSG_PEEK: ::std::os::raw::c_uint = 2; +pub const MSG_DONTROUTE: ::std::os::raw::c_uint = 4; +pub const MSG_CTRUNC: ::std::os::raw::c_uint = 8; +pub const MSG_PROXY: ::std::os::raw::c_uint = 16; +pub const MSG_TRUNC: ::std::os::raw::c_uint = 32; +pub const MSG_DONTWAIT: ::std::os::raw::c_uint = 64; +pub const MSG_EOR: ::std::os::raw::c_uint = 128; +pub const MSG_WAITALL: ::std::os::raw::c_uint = 256; +pub const MSG_FIN: ::std::os::raw::c_uint = 512; +pub const MSG_SYN: ::std::os::raw::c_uint = 1024; +pub const MSG_CONFIRM: ::std::os::raw::c_uint = 2048; +pub const MSG_RST: ::std::os::raw::c_uint = 4096; +pub const MSG_ERRQUEUE: ::std::os::raw::c_uint = 8192; +pub const MSG_NOSIGNAL: ::std::os::raw::c_uint = 16384; +pub const MSG_MORE: ::std::os::raw::c_uint = 32768; +pub const MSG_WAITFORONE: ::std::os::raw::c_uint = 65536; +pub const MSG_BATCH: ::std::os::raw::c_uint = 262144; +pub const MSG_ZEROCOPY: ::std::os::raw::c_uint = 67108864; +pub const MSG_FASTOPEN: ::std::os::raw::c_uint = 536870912; +pub const MSG_CMSG_CLOEXEC: ::std::os::raw::c_uint = 1073741824; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, + pub __cmsg_data: __IncompleteArrayField<::std::os::raw::c_uchar>, +} +extern "C" { + pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +pub const SCM_RIGHTS: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_2 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct osockaddr { + pub sa_family: ::std::os::raw::c_ushort, + pub sa_data: [::std::os::raw::c_uchar; 14usize], +} +pub const SHUT_RD: ::std::os::raw::c_uint = 0; +pub const SHUT_WR: ::std::os::raw::c_uint = 1; +pub const SHUT_RDWR: ::std::os::raw::c_uint = 2; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +extern "C" { + pub fn socket( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_len: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> isize; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __message: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __message: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *mut ::std::os::raw::c_void, + __optlen: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *const ::std::os::raw::c_void, + __optlen: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen(__fd: ::std::os::raw::c_int, __n: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sockatmark(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isfdtype( + __fd: ::std::os::raw::c_int, + __fdtype: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub type in_addr_t = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_addr { + pub s_addr: in_addr_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ip_opts { + pub ip_dst: in_addr, + pub ip_opts: [::std::os::raw::c_char; 40usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreqn { + pub imr_multiaddr: in_addr, + pub imr_address: in_addr, + pub imr_ifindex: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_pktinfo { + pub ipi_ifindex: ::std::os::raw::c_int, + pub ipi_spec_dst: in_addr, + pub ipi_addr: in_addr, +} +pub const IPPROTO_IP: ::std::os::raw::c_uint = 0; +pub const IPPROTO_ICMP: ::std::os::raw::c_uint = 1; +pub const IPPROTO_IGMP: ::std::os::raw::c_uint = 2; +pub const IPPROTO_IPIP: ::std::os::raw::c_uint = 4; +pub const IPPROTO_TCP: ::std::os::raw::c_uint = 6; +pub const IPPROTO_EGP: ::std::os::raw::c_uint = 8; +pub const IPPROTO_PUP: ::std::os::raw::c_uint = 12; +pub const IPPROTO_UDP: ::std::os::raw::c_uint = 17; +pub const IPPROTO_IDP: ::std::os::raw::c_uint = 22; +pub const IPPROTO_TP: ::std::os::raw::c_uint = 29; +pub const IPPROTO_DCCP: ::std::os::raw::c_uint = 33; +pub const IPPROTO_IPV6: ::std::os::raw::c_uint = 41; +pub const IPPROTO_RSVP: ::std::os::raw::c_uint = 46; +pub const IPPROTO_GRE: ::std::os::raw::c_uint = 47; +pub const IPPROTO_ESP: ::std::os::raw::c_uint = 50; +pub const IPPROTO_AH: ::std::os::raw::c_uint = 51; +pub const IPPROTO_MTP: ::std::os::raw::c_uint = 92; +pub const IPPROTO_BEETPH: ::std::os::raw::c_uint = 94; +pub const IPPROTO_ENCAP: ::std::os::raw::c_uint = 98; +pub const IPPROTO_PIM: ::std::os::raw::c_uint = 103; +pub const IPPROTO_COMP: ::std::os::raw::c_uint = 108; +pub const IPPROTO_SCTP: ::std::os::raw::c_uint = 132; +pub const IPPROTO_UDPLITE: ::std::os::raw::c_uint = 136; +pub const IPPROTO_MPLS: ::std::os::raw::c_uint = 137; +pub const IPPROTO_ETHERNET: ::std::os::raw::c_uint = 143; +pub const IPPROTO_RAW: ::std::os::raw::c_uint = 255; +pub const IPPROTO_MPTCP: ::std::os::raw::c_uint = 262; +pub const IPPROTO_MAX: ::std::os::raw::c_uint = 263; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +pub const IPPROTO_HOPOPTS: ::std::os::raw::c_uint = 0; +pub const IPPROTO_ROUTING: ::std::os::raw::c_uint = 43; +pub const IPPROTO_FRAGMENT: ::std::os::raw::c_uint = 44; +pub const IPPROTO_ICMPV6: ::std::os::raw::c_uint = 58; +pub const IPPROTO_NONE: ::std::os::raw::c_uint = 59; +pub const IPPROTO_DSTOPTS: ::std::os::raw::c_uint = 60; +pub const IPPROTO_MH: ::std::os::raw::c_uint = 135; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; +pub type in_port_t = u16; +pub const IPPORT_ECHO: ::std::os::raw::c_uint = 7; +pub const IPPORT_DISCARD: ::std::os::raw::c_uint = 9; +pub const IPPORT_SYSTAT: ::std::os::raw::c_uint = 11; +pub const IPPORT_DAYTIME: ::std::os::raw::c_uint = 13; +pub const IPPORT_NETSTAT: ::std::os::raw::c_uint = 15; +pub const IPPORT_FTP: ::std::os::raw::c_uint = 21; +pub const IPPORT_TELNET: ::std::os::raw::c_uint = 23; +pub const IPPORT_SMTP: ::std::os::raw::c_uint = 25; +pub const IPPORT_TIMESERVER: ::std::os::raw::c_uint = 37; +pub const IPPORT_NAMESERVER: ::std::os::raw::c_uint = 42; +pub const IPPORT_WHOIS: ::std::os::raw::c_uint = 43; +pub const IPPORT_MTP: ::std::os::raw::c_uint = 57; +pub const IPPORT_TFTP: ::std::os::raw::c_uint = 69; +pub const IPPORT_RJE: ::std::os::raw::c_uint = 77; +pub const IPPORT_FINGER: ::std::os::raw::c_uint = 79; +pub const IPPORT_TTYLINK: ::std::os::raw::c_uint = 87; +pub const IPPORT_SUPDUP: ::std::os::raw::c_uint = 95; +pub const IPPORT_EXECSERVER: ::std::os::raw::c_uint = 512; +pub const IPPORT_LOGINSERVER: ::std::os::raw::c_uint = 513; +pub const IPPORT_CMDSERVER: ::std::os::raw::c_uint = 514; +pub const IPPORT_EFSSERVER: ::std::os::raw::c_uint = 520; +pub const IPPORT_BIFFUDP: ::std::os::raw::c_uint = 512; +pub const IPPORT_WHOSERVER: ::std::os::raw::c_uint = 513; +pub const IPPORT_ROUTESERVER: ::std::os::raw::c_uint = 520; +pub const IPPORT_RESERVED: ::std::os::raw::c_uint = 1024; +pub const IPPORT_USERRESERVED: ::std::os::raw::c_uint = 5000; +pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct in6_addr { + pub __in6_u: in6_addr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union in6_addr__bindgen_ty_1 { + pub __u6_addr8: [u8; 16usize], + pub __u6_addr16: [u16; 8usize], + pub __u6_addr32: [u32; 4usize], + _bindgen_union_align: [u32; 4usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [::std::os::raw::c_uchar; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + pub ipv6mr_interface: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_req { + pub gr_interface: u32, + pub gr_group: sockaddr_storage, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: sockaddr_storage, + pub gsr_source: sockaddr_storage, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_msfilter { + pub imsf_multiaddr: in_addr, + pub imsf_interface: in_addr, + pub imsf_fmode: u32, + pub imsf_numsrc: u32, + pub imsf_slist: [in_addr; 1usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_filter { + pub gf_interface: u32, + pub gf_group: sockaddr_storage, + pub gf_fmode: u32, + pub gf_numsrc: u32, + pub gf_slist: [sockaddr_storage; 1usize], +} +extern "C" { + pub fn ntohl(__netlong: u32) -> u32; +} +extern "C" { + pub fn ntohs(__netshort: u16) -> u16; +} +extern "C" { + pub fn htonl(__hostlong: u32) -> u32; +} +extern "C" { + pub fn htons(__hostshort: u16) -> u16; +} +extern "C" { + pub fn bindresvport( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bindresvport6( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in6, + ) -> ::std::os::raw::c_int; +} +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +extern "C" { + pub fn __errno_location() -> *mut ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +extern "C" { + pub fn gettimeofday( + __tv: *mut timeval, + __tz: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn settimeofday(__tv: *const timeval, __tz: *const timezone) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn adjtime(__delta: *const timeval, __olddelta: *mut timeval) -> ::std::os::raw::c_int; +} +pub const ITIMER_REAL: __itimer_which = 0; +pub const ITIMER_VIRTUAL: __itimer_which = 1; +pub const ITIMER_PROF: __itimer_which = 2; +pub type __itimer_which = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, +} +pub type __itimer_which_t = ::std::os::raw::c_int; +extern "C" { + pub fn getitimer(__which: __itimer_which_t, __value: *mut itimerval) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setitimer( + __which: __itimer_which_t, + __new: *const itimerval, + __old: *mut itimerval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn utimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lutimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn futimes(__fd: ::std::os::raw::c_int, __tvp: *const timeval) -> ::std::os::raw::c_int; +} +pub type cs_time_t = i64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cs_name_t { + pub length: u16, + pub value: [u8; 256usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cs_version_t { + pub releaseCode: ::std::os::raw::c_char, + pub majorVersion: ::std::os::raw::c_uchar, + pub minorVersion: ::std::os::raw::c_uchar, +} +pub const CS_DISPATCH_ONE: cs_dispatch_flags_t = 1; +pub const CS_DISPATCH_ALL: cs_dispatch_flags_t = 2; +pub const CS_DISPATCH_BLOCKING: cs_dispatch_flags_t = 3; +pub const CS_DISPATCH_ONE_NONBLOCKING: cs_dispatch_flags_t = 4; +pub type cs_dispatch_flags_t = ::std::os::raw::c_uint; +pub const CS_OK: cs_error_t = 1; +pub const CS_ERR_LIBRARY: cs_error_t = 2; +pub const CS_ERR_VERSION: cs_error_t = 3; +pub const CS_ERR_INIT: cs_error_t = 4; +pub const CS_ERR_TIMEOUT: cs_error_t = 5; +pub const CS_ERR_TRY_AGAIN: cs_error_t = 6; +pub const CS_ERR_INVALID_PARAM: cs_error_t = 7; +pub const CS_ERR_NO_MEMORY: cs_error_t = 8; +pub const CS_ERR_BAD_HANDLE: cs_error_t = 9; +pub const CS_ERR_BUSY: cs_error_t = 10; +pub const CS_ERR_ACCESS: cs_error_t = 11; +pub const CS_ERR_NOT_EXIST: cs_error_t = 12; +pub const CS_ERR_NAME_TOO_LONG: cs_error_t = 13; +pub const CS_ERR_EXIST: cs_error_t = 14; +pub const CS_ERR_NO_SPACE: cs_error_t = 15; +pub const CS_ERR_INTERRUPT: cs_error_t = 16; +pub const CS_ERR_NAME_NOT_FOUND: cs_error_t = 17; +pub const CS_ERR_NO_RESOURCES: cs_error_t = 18; +pub const CS_ERR_NOT_SUPPORTED: cs_error_t = 19; +pub const CS_ERR_BAD_OPERATION: cs_error_t = 20; +pub const CS_ERR_FAILED_OPERATION: cs_error_t = 21; +pub const CS_ERR_MESSAGE_ERROR: cs_error_t = 22; +pub const CS_ERR_QUEUE_FULL: cs_error_t = 23; +pub const CS_ERR_QUEUE_NOT_AVAILABLE: cs_error_t = 24; +pub const CS_ERR_BAD_FLAGS: cs_error_t = 25; +pub const CS_ERR_TOO_BIG: cs_error_t = 26; +pub const CS_ERR_NO_SECTIONS: cs_error_t = 27; +pub const CS_ERR_CONTEXT_NOT_FOUND: cs_error_t = 28; +pub const CS_ERR_TOO_MANY_GROUPS: cs_error_t = 30; +pub const CS_ERR_SECURITY: cs_error_t = 100; +pub type cs_error_t = ::std::os::raw::c_uint; +extern "C" { + pub fn qb_to_cs_error(result: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cs_strerror(err: cs_error_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn hdb_error_to_cs(res: ::std::os::raw::c_int) -> cs_error_t; +} +pub type corosync_cfg_handle_t = u64; +pub const COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST: corosync_cfg_shutdown_flags_t = 0; +pub const COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS: corosync_cfg_shutdown_flags_t = 1; +pub const COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE: corosync_cfg_shutdown_flags_t = 2; +pub type corosync_cfg_shutdown_flags_t = ::std::os::raw::c_uint; +pub const COROSYNC_CFG_SHUTDOWN_FLAG_NO: corosync_cfg_shutdown_reply_flags_t = 0; +pub const COROSYNC_CFG_SHUTDOWN_FLAG_YES: corosync_cfg_shutdown_reply_flags_t = 1; +pub type corosync_cfg_shutdown_reply_flags_t = ::std::os::raw::c_uint; +pub type corosync_cfg_shutdown_callback_t = ::std::option::Option< + unsafe extern "C" fn(cfg_handle: corosync_cfg_handle_t, flags: corosync_cfg_shutdown_flags_t), +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct corosync_cfg_callbacks_t { + pub corosync_cfg_shutdown_callback: corosync_cfg_shutdown_callback_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct corosync_cfg_node_address_t { + pub address_length: ::std::os::raw::c_int, + pub address: [::std::os::raw::c_char; 28usize], +} +extern "C" { + pub fn corosync_cfg_initialize( + cfg_handle: *mut corosync_cfg_handle_t, + cfg_callbacks: *const corosync_cfg_callbacks_t, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_fd_get( + cfg_handle: corosync_cfg_handle_t, + selection_fd: *mut i32, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_dispatch( + cfg_handle: corosync_cfg_handle_t, + dispatch_flags: cs_dispatch_flags_t, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_finalize(cfg_handle: corosync_cfg_handle_t) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_ring_status_get( + cfg_handle: corosync_cfg_handle_t, + interface_names: *mut *mut *mut ::std::os::raw::c_char, + status: *mut *mut *mut ::std::os::raw::c_char, + interface_count: *mut ::std::os::raw::c_uint, + ) -> cs_error_t; +} +pub const CFG_NODE_STATUS_V1: corosync_cfg_node_status_version_t = 1; +pub type corosync_cfg_node_status_version_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct corosync_knet_link_status_v1 { + pub enabled: u8, + pub connected: u8, + pub dynconnected: u8, + pub mtu: ::std::os::raw::c_uint, + pub src_ipaddr: [::std::os::raw::c_char; 256usize], + pub dst_ipaddr: [::std::os::raw::c_char; 256usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct corosync_cfg_node_status_v1 { + pub version: corosync_cfg_node_status_version_t, + pub nodeid: ::std::os::raw::c_uint, + pub reachable: u8, + pub remote: u8, + pub external: u8, + pub onwire_min: u8, + pub onwire_max: u8, + pub onwire_ver: u8, + pub link_status: [corosync_knet_link_status_v1; 8usize], +} +extern "C" { + pub fn corosync_cfg_node_status_get( + cfg_handle: corosync_cfg_handle_t, + nodeid: ::std::os::raw::c_uint, + version: corosync_cfg_node_status_version_t, + node_status: *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_kill_node( + cfg_handle: corosync_cfg_handle_t, + nodeid: ::std::os::raw::c_uint, + reason: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_trackstart( + cfg_handle: corosync_cfg_handle_t, + track_flags: u8, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_trackstop(cfg_handle: corosync_cfg_handle_t) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_try_shutdown( + cfg_handle: corosync_cfg_handle_t, + flags: corosync_cfg_shutdown_flags_t, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_replyto_shutdown( + cfg_handle: corosync_cfg_handle_t, + flags: corosync_cfg_shutdown_reply_flags_t, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_get_node_addrs( + cfg_handle: corosync_cfg_handle_t, + nodeid: ::std::os::raw::c_uint, + max_addrs: usize, + num_addrs: *mut ::std::os::raw::c_int, + addrs: *mut corosync_cfg_node_address_t, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_local_get( + handle: corosync_cfg_handle_t, + local_nodeid: *mut ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_reload_config(handle: corosync_cfg_handle_t) -> cs_error_t; +} +extern "C" { + pub fn corosync_cfg_reopen_log_files(handle: corosync_cfg_handle_t) -> cs_error_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cmap.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cmap.rs new file mode 100644 index 00000000..42afb2cd --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cmap.rs @@ -0,0 +1,3323 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +extern "C" { + pub fn __errno_location() -> *mut ::std::os::raw::c_int; +} +pub type clock_t = __clock_t; +pub type time_t = __time_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +pub type clockid_t = __clockid_t; +pub type timer_t = __timer_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +pub type pid_t = __pid_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +pub type suseconds_t = __suseconds_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +pub type sigset_t = __sigset_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +extern "C" { + pub fn gettimeofday( + __tv: *mut timeval, + __tz: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn settimeofday(__tv: *const timeval, __tz: *const timezone) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn adjtime(__delta: *const timeval, __olddelta: *mut timeval) -> ::std::os::raw::c_int; +} +pub const ITIMER_REAL: __itimer_which = 0; +pub const ITIMER_VIRTUAL: __itimer_which = 1; +pub const ITIMER_PROF: __itimer_which = 2; +pub type __itimer_which = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, +} +pub type __itimer_which_t = ::std::os::raw::c_int; +extern "C" { + pub fn getitimer(__which: __itimer_which_t, __value: *mut itimerval) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setitimer( + __which: __itimer_which_t, + __new: *const itimerval, + __old: *mut itimerval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn utimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lutimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn futimes(__fd: ::std::os::raw::c_int, __tvp: *const timeval) -> ::std::os::raw::c_int; +} +pub type cs_time_t = i64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cs_name_t { + pub length: u16, + pub value: [u8; 256usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cs_version_t { + pub releaseCode: ::std::os::raw::c_char, + pub majorVersion: ::std::os::raw::c_uchar, + pub minorVersion: ::std::os::raw::c_uchar, +} +pub const CS_DISPATCH_ONE: cs_dispatch_flags_t = 1; +pub const CS_DISPATCH_ALL: cs_dispatch_flags_t = 2; +pub const CS_DISPATCH_BLOCKING: cs_dispatch_flags_t = 3; +pub const CS_DISPATCH_ONE_NONBLOCKING: cs_dispatch_flags_t = 4; +pub type cs_dispatch_flags_t = ::std::os::raw::c_uint; +pub const CS_OK: cs_error_t = 1; +pub const CS_ERR_LIBRARY: cs_error_t = 2; +pub const CS_ERR_VERSION: cs_error_t = 3; +pub const CS_ERR_INIT: cs_error_t = 4; +pub const CS_ERR_TIMEOUT: cs_error_t = 5; +pub const CS_ERR_TRY_AGAIN: cs_error_t = 6; +pub const CS_ERR_INVALID_PARAM: cs_error_t = 7; +pub const CS_ERR_NO_MEMORY: cs_error_t = 8; +pub const CS_ERR_BAD_HANDLE: cs_error_t = 9; +pub const CS_ERR_BUSY: cs_error_t = 10; +pub const CS_ERR_ACCESS: cs_error_t = 11; +pub const CS_ERR_NOT_EXIST: cs_error_t = 12; +pub const CS_ERR_NAME_TOO_LONG: cs_error_t = 13; +pub const CS_ERR_EXIST: cs_error_t = 14; +pub const CS_ERR_NO_SPACE: cs_error_t = 15; +pub const CS_ERR_INTERRUPT: cs_error_t = 16; +pub const CS_ERR_NAME_NOT_FOUND: cs_error_t = 17; +pub const CS_ERR_NO_RESOURCES: cs_error_t = 18; +pub const CS_ERR_NOT_SUPPORTED: cs_error_t = 19; +pub const CS_ERR_BAD_OPERATION: cs_error_t = 20; +pub const CS_ERR_FAILED_OPERATION: cs_error_t = 21; +pub const CS_ERR_MESSAGE_ERROR: cs_error_t = 22; +pub const CS_ERR_QUEUE_FULL: cs_error_t = 23; +pub const CS_ERR_QUEUE_NOT_AVAILABLE: cs_error_t = 24; +pub const CS_ERR_BAD_FLAGS: cs_error_t = 25; +pub const CS_ERR_TOO_BIG: cs_error_t = 26; +pub const CS_ERR_NO_SECTIONS: cs_error_t = 27; +pub const CS_ERR_CONTEXT_NOT_FOUND: cs_error_t = 28; +pub const CS_ERR_TOO_MANY_GROUPS: cs_error_t = 30; +pub const CS_ERR_SECURITY: cs_error_t = 100; +pub type cs_error_t = ::std::os::raw::c_uint; +extern "C" { + pub fn qb_to_cs_error(result: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cs_strerror(err: cs_error_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn hdb_error_to_cs(res: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn __assert_fail( + __assertion: *const ::std::os::raw::c_char, + __file: *const ::std::os::raw::c_char, + __line: ::std::os::raw::c_uint, + __function: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn __assert_perror_fail( + __errnum: ::std::os::raw::c_int, + __file: *const ::std::os::raw::c_char, + __line: ::std::os::raw::c_uint, + __function: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn __assert( + __assertion: *const ::std::os::raw::c_char, + __file: *const ::std::os::raw::c_char, + __line: ::std::os::raw::c_int, + ); +} +pub type wchar_t = ::std::os::raw::c_int; +pub type _Float32 = f32; +pub type _Float64 = f64; +pub type _Float32x = f64; +pub type _Float64x = u128; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn atof(__nptr: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn atoi(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtod( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtof( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn strtold( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + ) -> u128; +} +extern "C" { + pub fn strtol( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoul( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoq( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtouq( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtoll( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn l64a(__n: ::std::os::raw::c_long) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn a64l(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +pub type u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __bindgen_anon_1: __pthread_cond_s__bindgen_ty_1, + pub __bindgen_anon_2: __pthread_cond_s__bindgen_ty_2, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_1 { + pub __wseq: ::std::os::raw::c_ulonglong, + pub __wseq32: __pthread_cond_s__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_1__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_2 { + pub __g1_start: ::std::os::raw::c_ulonglong, + pub __g1_start32: __pthread_cond_s__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_2__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 5usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, + _bindgen_union_align: [u64; 6usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: u64, +} +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __statebuf: *mut ::std::os::raw::c_char, + __statelen: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__statebuf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct random_data { + pub fptr: *mut i32, + pub rptr: *mut i32, + pub state: *mut i32, + pub rand_type: ::std::os::raw::c_int, + pub rand_deg: ::std::os::raw::c_int, + pub rand_sep: ::std::os::raw::c_int, + pub end_ptr: *mut i32, +} +extern "C" { + pub fn random_r(__buf: *mut random_data, __result: *mut i32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srandom_r( + __seed: ::std::os::raw::c_uint, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn initstate_r( + __seed: ::std::os::raw::c_uint, + __statebuf: *mut ::std::os::raw::c_char, + __statelen: usize, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setstate_r( + __statebuf: *mut ::std::os::raw::c_char, + __buf: *mut random_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn rand_r(__seed: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srand48(__seedval: ::std::os::raw::c_long); +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct drand48_data { + pub __x: [::std::os::raw::c_ushort; 3usize], + pub __old_x: [::std::os::raw::c_ushort; 3usize], + pub __c: ::std::os::raw::c_ushort, + pub __init: ::std::os::raw::c_ushort, + pub __a: ::std::os::raw::c_ulonglong, +} +extern "C" { + pub fn drand48_r(__buffer: *mut drand48_data, __result: *mut f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn erand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut f64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lrand48_r( + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nrand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mrand48_r( + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn jrand48_r( + __xsubi: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + __result: *mut ::std::os::raw::c_long, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand48_r( + __seedval: ::std::os::raw::c_long, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn seed48_r( + __seed16v: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lcong48_r( + __param: *mut ::std::os::raw::c_ushort, + __buffer: *mut drand48_data, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn malloc(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __nmemb: ::std::os::raw::c_ulong, + __size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn alloca(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn valloc(__size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn atexit(__func: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __func: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn on_exit( + __func: ::std::option::Option< + unsafe extern "C" fn( + __status: ::std::os::raw::c_int, + __arg: *mut ::std::os::raw::c_void, + ), + >, + __arg: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__string: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __replace: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __suffixlen: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn realpath( + __name: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +pub type __compar_fn_t = ::std::option::Option< + unsafe extern "C" fn( + arg1: *const ::std::os::raw::c_void, + arg2: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __compar: __compar_fn_t, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __compar: __compar_fn_t, + ); +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn div(__numer: ::std::os::raw::c_int, __denom: ::std::os::raw::c_int) -> div_t; +} +extern "C" { + pub fn ldiv(__numer: ::std::os::raw::c_long, __denom: ::std::os::raw::c_long) -> ldiv_t; +} +extern "C" { + pub fn lldiv( + __numer: ::std::os::raw::c_longlong, + __denom: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn ecvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fcvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn gcvt( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qecvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qfcvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn qgcvt( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ecvt_r( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fcvt_r( + __value: f64, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn qecvt_r( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn qfcvt_r( + __value: u128, + __ndigit: ::std::os::raw::c_int, + __decpt: *mut ::std::os::raw::c_int, + __sign: *mut ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbtowc( + __pwc: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__s: *mut ::std::os::raw::c_char, __wchar: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const ::std::os::raw::c_char, __n: usize) -> usize; +} +extern "C" { + pub fn wcstombs(__s: *mut ::std::os::raw::c_char, __pwcs: *const wchar_t, __n: usize) -> usize; +} +extern "C" { + pub fn rpmatch(__response: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __optionp: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __valuep: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getloadavg(__loadavg: *mut f64, __nelem: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn memcpy( + __dest: *mut ::std::os::raw::c_void, + __src: *const ::std::os::raw::c_void, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn memmove( + __dest: *mut ::std::os::raw::c_void, + __src: *const ::std::os::raw::c_void, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn memccpy( + __dest: *mut ::std::os::raw::c_void, + __src: *const ::std::os::raw::c_void, + __c: ::std::os::raw::c_int, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn memset( + __s: *mut ::std::os::raw::c_void, + __c: ::std::os::raw::c_int, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn memcmp( + __s1: *const ::std::os::raw::c_void, + __s2: *const ::std::os::raw::c_void, + __n: ::std::os::raw::c_ulong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn memchr( + __s: *const ::std::os::raw::c_void, + __c: ::std::os::raw::c_int, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn strcpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strncpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strcat( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strncat( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strcmp( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strncmp( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strcoll( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strxfrm( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strcoll_l( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + __l: locale_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strxfrm_l( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: usize, + __l: locale_t, + ) -> usize; +} +extern "C" { + pub fn strdup(__s: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strndup( + __string: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strchr( + __s: *const ::std::os::raw::c_char, + __c: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strrchr( + __s: *const ::std::os::raw::c_char, + __c: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strcspn( + __s: *const ::std::os::raw::c_char, + __reject: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strspn( + __s: *const ::std::os::raw::c_char, + __accept: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strpbrk( + __s: *const ::std::os::raw::c_char, + __accept: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strstr( + __haystack: *const ::std::os::raw::c_char, + __needle: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strtok( + __s: *mut ::std::os::raw::c_char, + __delim: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __strtok_r( + __s: *mut ::std::os::raw::c_char, + __delim: *const ::std::os::raw::c_char, + __save_ptr: *mut *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strtok_r( + __s: *mut ::std::os::raw::c_char, + __delim: *const ::std::os::raw::c_char, + __save_ptr: *mut *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strlen(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strnlen(__string: *const ::std::os::raw::c_char, __maxlen: usize) -> usize; +} +extern "C" { + pub fn strerror(__errnum: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + #[link_name = "\u{1}__xpg_strerror_r"] + pub fn strerror_r( + __errnum: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __buflen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strerror_l( + __errnum: ::std::os::raw::c_int, + __l: locale_t, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn bcmp( + __s1: *const ::std::os::raw::c_void, + __s2: *const ::std::os::raw::c_void, + __n: ::std::os::raw::c_ulong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bcopy( + __src: *const ::std::os::raw::c_void, + __dest: *mut ::std::os::raw::c_void, + __n: usize, + ); +} +extern "C" { + pub fn bzero(__s: *mut ::std::os::raw::c_void, __n: ::std::os::raw::c_ulong); +} +extern "C" { + pub fn index( + __s: *const ::std::os::raw::c_char, + __c: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn rindex( + __s: *const ::std::os::raw::c_char, + __c: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ffs(__i: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ffsl(__l: ::std::os::raw::c_long) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ffsll(__ll: ::std::os::raw::c_longlong) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strcasecmp( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strncasecmp( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strcasecmp_l( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + __loc: locale_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strncasecmp_l( + __s1: *const ::std::os::raw::c_char, + __s2: *const ::std::os::raw::c_char, + __n: usize, + __loc: locale_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn explicit_bzero(__s: *mut ::std::os::raw::c_void, __n: usize); +} +extern "C" { + pub fn strsep( + __stringp: *mut *mut ::std::os::raw::c_char, + __delim: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn strsignal(__sig: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __stpcpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn stpcpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __stpncpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn stpncpy( + __dest: *mut ::std::os::raw::c_char, + __src: *const ::std::os::raw::c_char, + __n: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sched_param { + pub sched_priority: ::std::os::raw::c_int, +} +pub type __cpu_mask = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpu_set_t { + pub __bits: [__cpu_mask; 16usize], +} +extern "C" { + pub fn __sched_cpucount(__setsize: usize, __setp: *const cpu_set_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __sched_cpualloc(__count: usize) -> *mut cpu_set_t; +} +extern "C" { + pub fn __sched_cpufree(__set: *mut cpu_set_t); +} +extern "C" { + pub fn sched_setparam(__pid: __pid_t, __param: *const sched_param) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_getparam(__pid: __pid_t, __param: *mut sched_param) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_setscheduler( + __pid: __pid_t, + __policy: ::std::os::raw::c_int, + __param: *const sched_param, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_getscheduler(__pid: __pid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_yield() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_get_priority_max(__algorithm: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_get_priority_min(__algorithm: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sched_rr_get_interval(__pid: __pid_t, __t: *mut timespec) -> ::std::os::raw::c_int; +} +pub type __jmp_buf = [::std::os::raw::c_long; 8usize]; +pub const PTHREAD_CREATE_JOINABLE: ::std::os::raw::c_uint = 0; +pub const PTHREAD_CREATE_DETACHED: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +pub const PTHREAD_MUTEX_TIMED_NP: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_RECURSIVE_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_MUTEX_ERRORCHECK_NP: ::std::os::raw::c_uint = 2; +pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::std::os::raw::c_uint = 3; +pub const PTHREAD_MUTEX_NORMAL: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::std::os::raw::c_uint = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: ::std::os::raw::c_uint = 2; +pub const PTHREAD_MUTEX_DEFAULT: ::std::os::raw::c_uint = 0; +pub type _bindgen_ty_2 = ::std::os::raw::c_uint; +pub const PTHREAD_MUTEX_STALLED: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_STALLED_NP: ::std::os::raw::c_uint = 0; +pub const PTHREAD_MUTEX_ROBUST: ::std::os::raw::c_uint = 1; +pub const PTHREAD_MUTEX_ROBUST_NP: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +pub const PTHREAD_PRIO_NONE: ::std::os::raw::c_uint = 0; +pub const PTHREAD_PRIO_INHERIT: ::std::os::raw::c_uint = 1; +pub const PTHREAD_PRIO_PROTECT: ::std::os::raw::c_uint = 2; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +pub const PTHREAD_RWLOCK_PREFER_READER_NP: ::std::os::raw::c_uint = 0; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NP: ::std::os::raw::c_uint = 1; +pub const PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ::std::os::raw::c_uint = 2; +pub const PTHREAD_RWLOCK_DEFAULT_NP: ::std::os::raw::c_uint = 0; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; +pub const PTHREAD_INHERIT_SCHED: ::std::os::raw::c_uint = 0; +pub const PTHREAD_EXPLICIT_SCHED: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +pub const PTHREAD_SCOPE_SYSTEM: ::std::os::raw::c_uint = 0; +pub const PTHREAD_SCOPE_PROCESS: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_7 = ::std::os::raw::c_uint; +pub const PTHREAD_PROCESS_PRIVATE: ::std::os::raw::c_uint = 0; +pub const PTHREAD_PROCESS_SHARED: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_8 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _pthread_cleanup_buffer { + pub __routine: ::std::option::Option, + pub __arg: *mut ::std::os::raw::c_void, + pub __canceltype: ::std::os::raw::c_int, + pub __prev: *mut _pthread_cleanup_buffer, +} +pub const PTHREAD_CANCEL_ENABLE: ::std::os::raw::c_uint = 0; +pub const PTHREAD_CANCEL_DISABLE: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_9 = ::std::os::raw::c_uint; +pub const PTHREAD_CANCEL_DEFERRED: ::std::os::raw::c_uint = 0; +pub const PTHREAD_CANCEL_ASYNCHRONOUS: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_10 = ::std::os::raw::c_uint; +extern "C" { + pub fn pthread_create( + __newthread: *mut pthread_t, + __attr: *const pthread_attr_t, + __start_routine: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void, + >, + __arg: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_exit(__retval: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn pthread_join( + __th: pthread_t, + __thread_return: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_detach(__th: pthread_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_self() -> pthread_t; +} +extern "C" { + pub fn pthread_equal(__thread1: pthread_t, __thread2: pthread_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_init(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_destroy(__attr: *mut pthread_attr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getdetachstate( + __attr: *const pthread_attr_t, + __detachstate: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setdetachstate( + __attr: *mut pthread_attr_t, + __detachstate: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getguardsize( + __attr: *const pthread_attr_t, + __guardsize: *mut usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setguardsize( + __attr: *mut pthread_attr_t, + __guardsize: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getschedparam( + __attr: *const pthread_attr_t, + __param: *mut sched_param, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setschedparam( + __attr: *mut pthread_attr_t, + __param: *const sched_param, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getschedpolicy( + __attr: *const pthread_attr_t, + __policy: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setschedpolicy( + __attr: *mut pthread_attr_t, + __policy: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getinheritsched( + __attr: *const pthread_attr_t, + __inherit: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setinheritsched( + __attr: *mut pthread_attr_t, + __inherit: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getscope( + __attr: *const pthread_attr_t, + __scope: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setscope( + __attr: *mut pthread_attr_t, + __scope: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getstackaddr( + __attr: *const pthread_attr_t, + __stackaddr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setstackaddr( + __attr: *mut pthread_attr_t, + __stackaddr: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getstacksize( + __attr: *const pthread_attr_t, + __stacksize: *mut usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setstacksize( + __attr: *mut pthread_attr_t, + __stacksize: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_getstack( + __attr: *const pthread_attr_t, + __stackaddr: *mut *mut ::std::os::raw::c_void, + __stacksize: *mut usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_attr_setstack( + __attr: *mut pthread_attr_t, + __stackaddr: *mut ::std::os::raw::c_void, + __stacksize: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_setschedparam( + __target_thread: pthread_t, + __policy: ::std::os::raw::c_int, + __param: *const sched_param, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_getschedparam( + __target_thread: pthread_t, + __policy: *mut ::std::os::raw::c_int, + __param: *mut sched_param, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_setschedprio( + __target_thread: pthread_t, + __prio: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_once( + __once_control: *mut pthread_once_t, + __init_routine: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_setcancelstate( + __state: ::std::os::raw::c_int, + __oldstate: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_setcanceltype( + __type: ::std::os::raw::c_int, + __oldtype: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cancel(__th: pthread_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_testcancel(); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_unwind_buf_t { + pub __cancel_jmp_buf: [__pthread_unwind_buf_t__bindgen_ty_1; 1usize], + pub __pad: [*mut ::std::os::raw::c_void; 4usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_unwind_buf_t__bindgen_ty_1 { + pub __cancel_jmp_buf: __jmp_buf, + pub __mask_was_saved: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cleanup_frame { + pub __cancel_routine: + ::std::option::Option, + pub __cancel_arg: *mut ::std::os::raw::c_void, + pub __do_it: ::std::os::raw::c_int, + pub __cancel_type: ::std::os::raw::c_int, +} +extern "C" { + pub fn __pthread_register_cancel(__buf: *mut __pthread_unwind_buf_t); +} +extern "C" { + pub fn __pthread_unregister_cancel(__buf: *mut __pthread_unwind_buf_t); +} +extern "C" { + pub fn __pthread_unwind_next(__buf: *mut __pthread_unwind_buf_t); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __jmp_buf_tag { + _unused: [u8; 0], +} +extern "C" { + pub fn __sigsetjmp( + __env: *mut __jmp_buf_tag, + __savemask: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_init( + __mutex: *mut pthread_mutex_t, + __mutexattr: *const pthread_mutexattr_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_destroy(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_timedlock( + __mutex: *mut pthread_mutex_t, + __abstime: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_getprioceiling( + __mutex: *const pthread_mutex_t, + __prioceiling: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_setprioceiling( + __mutex: *mut pthread_mutex_t, + __prioceiling: ::std::os::raw::c_int, + __old_ceiling: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutex_consistent(__mutex: *mut pthread_mutex_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_init(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_destroy(__attr: *mut pthread_mutexattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_getpshared( + __attr: *const pthread_mutexattr_t, + __pshared: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_setpshared( + __attr: *mut pthread_mutexattr_t, + __pshared: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_gettype( + __attr: *const pthread_mutexattr_t, + __kind: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_settype( + __attr: *mut pthread_mutexattr_t, + __kind: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_getprotocol( + __attr: *const pthread_mutexattr_t, + __protocol: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_setprotocol( + __attr: *mut pthread_mutexattr_t, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_getprioceiling( + __attr: *const pthread_mutexattr_t, + __prioceiling: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_setprioceiling( + __attr: *mut pthread_mutexattr_t, + __prioceiling: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_getrobust( + __attr: *const pthread_mutexattr_t, + __robustness: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_mutexattr_setrobust( + __attr: *mut pthread_mutexattr_t, + __robustness: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_init( + __rwlock: *mut pthread_rwlock_t, + __attr: *const pthread_rwlockattr_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_destroy(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_rdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_tryrdlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_timedrdlock( + __rwlock: *mut pthread_rwlock_t, + __abstime: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_wrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_trywrlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_timedwrlock( + __rwlock: *mut pthread_rwlock_t, + __abstime: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlock_unlock(__rwlock: *mut pthread_rwlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_init(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_destroy(__attr: *mut pthread_rwlockattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_getpshared( + __attr: *const pthread_rwlockattr_t, + __pshared: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_setpshared( + __attr: *mut pthread_rwlockattr_t, + __pshared: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_getkind_np( + __attr: *const pthread_rwlockattr_t, + __pref: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_rwlockattr_setkind_np( + __attr: *mut pthread_rwlockattr_t, + __pref: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_init( + __cond: *mut pthread_cond_t, + __cond_attr: *const pthread_condattr_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_destroy(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_signal(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_broadcast(__cond: *mut pthread_cond_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_wait( + __cond: *mut pthread_cond_t, + __mutex: *mut pthread_mutex_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_cond_timedwait( + __cond: *mut pthread_cond_t, + __mutex: *mut pthread_mutex_t, + __abstime: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_init(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_destroy(__attr: *mut pthread_condattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_getpshared( + __attr: *const pthread_condattr_t, + __pshared: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_setpshared( + __attr: *mut pthread_condattr_t, + __pshared: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_getclock( + __attr: *const pthread_condattr_t, + __clock_id: *mut __clockid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_condattr_setclock( + __attr: *mut pthread_condattr_t, + __clock_id: __clockid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_spin_init( + __lock: *mut pthread_spinlock_t, + __pshared: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_spin_destroy(__lock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_spin_lock(__lock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_spin_trylock(__lock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_spin_unlock(__lock: *mut pthread_spinlock_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrier_init( + __barrier: *mut pthread_barrier_t, + __attr: *const pthread_barrierattr_t, + __count: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrier_destroy(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrier_wait(__barrier: *mut pthread_barrier_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrierattr_init(__attr: *mut pthread_barrierattr_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrierattr_destroy(__attr: *mut pthread_barrierattr_t) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrierattr_getpshared( + __attr: *const pthread_barrierattr_t, + __pshared: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_barrierattr_setpshared( + __attr: *mut pthread_barrierattr_t, + __pshared: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_key_create( + __key: *mut pthread_key_t, + __destr_function: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void), + >, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_key_delete(__key: pthread_key_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_getspecific(__key: pthread_key_t) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn pthread_setspecific( + __key: pthread_key_t, + __pointer: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_getcpuclockid( + __thread_id: pthread_t, + __clock_id: *mut __clockid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pthread_atfork( + __prepare: ::std::option::Option, + __parent: ::std::option::Option, + __child: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +pub type __gwchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct imaxdiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +extern "C" { + pub fn imaxabs(__n: intmax_t) -> intmax_t; +} +extern "C" { + pub fn imaxdiv(__numer: intmax_t, __denom: intmax_t) -> imaxdiv_t; +} +extern "C" { + pub fn strtoimax( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn strtoumax( + __nptr: *const ::std::os::raw::c_char, + __endptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +extern "C" { + pub fn wcstoimax( + __nptr: *const __gwchar_t, + __endptr: *mut *mut __gwchar_t, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn wcstoumax( + __nptr: *const __gwchar_t, + __endptr: *mut *mut __gwchar_t, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +pub type useconds_t = __useconds_t; +pub type socklen_t = __socklen_t; +extern "C" { + pub fn access( + __name: *const ::std::os::raw::c_char, + __type: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn faccessat( + __fd: ::std::os::raw::c_int, + __file: *const ::std::os::raw::c_char, + __type: ::std::os::raw::c_int, + __flag: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lseek( + __fd: ::std::os::raw::c_int, + __offset: __off_t, + __whence: ::std::os::raw::c_int, + ) -> __off_t; +} +extern "C" { + pub fn close(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn read( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __nbytes: usize, + ) -> isize; +} +extern "C" { + pub fn write( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + ) -> isize; +} +extern "C" { + pub fn pread( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __nbytes: usize, + __offset: __off_t, + ) -> isize; +} +extern "C" { + pub fn pwrite( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __offset: __off_t, + ) -> isize; +} +extern "C" { + pub fn pipe(__pipedes: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn alarm(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn sleep(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn ualarm(__value: __useconds_t, __interval: __useconds_t) -> __useconds_t; +} +extern "C" { + pub fn usleep(__useconds: __useconds_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pause() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn chown( + __file: *const ::std::os::raw::c_char, + __owner: __uid_t, + __group: __gid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fchown( + __fd: ::std::os::raw::c_int, + __owner: __uid_t, + __group: __gid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lchown( + __file: *const ::std::os::raw::c_char, + __owner: __uid_t, + __group: __gid_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fchownat( + __fd: ::std::os::raw::c_int, + __file: *const ::std::os::raw::c_char, + __owner: __uid_t, + __group: __gid_t, + __flag: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn chdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fchdir(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getcwd(__buf: *mut ::std::os::raw::c_char, __size: usize) + -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getwd(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn dup(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dup2(__fd: ::std::os::raw::c_int, __fd2: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execve( + __path: *const ::std::os::raw::c_char, + __argv: *const *mut ::std::os::raw::c_char, + __envp: *const *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fexecve( + __fd: ::std::os::raw::c_int, + __argv: *const *mut ::std::os::raw::c_char, + __envp: *const *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execv( + __path: *const ::std::os::raw::c_char, + __argv: *const *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execle( + __path: *const ::std::os::raw::c_char, + __arg: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execl( + __path: *const ::std::os::raw::c_char, + __arg: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execvp( + __file: *const ::std::os::raw::c_char, + __argv: *const *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn execlp( + __file: *const ::std::os::raw::c_char, + __arg: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nice(__inc: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn _exit(__status: ::std::os::raw::c_int); +} +pub const _PC_LINK_MAX: ::std::os::raw::c_uint = 0; +pub const _PC_MAX_CANON: ::std::os::raw::c_uint = 1; +pub const _PC_MAX_INPUT: ::std::os::raw::c_uint = 2; +pub const _PC_NAME_MAX: ::std::os::raw::c_uint = 3; +pub const _PC_PATH_MAX: ::std::os::raw::c_uint = 4; +pub const _PC_PIPE_BUF: ::std::os::raw::c_uint = 5; +pub const _PC_CHOWN_RESTRICTED: ::std::os::raw::c_uint = 6; +pub const _PC_NO_TRUNC: ::std::os::raw::c_uint = 7; +pub const _PC_VDISABLE: ::std::os::raw::c_uint = 8; +pub const _PC_SYNC_IO: ::std::os::raw::c_uint = 9; +pub const _PC_ASYNC_IO: ::std::os::raw::c_uint = 10; +pub const _PC_PRIO_IO: ::std::os::raw::c_uint = 11; +pub const _PC_SOCK_MAXBUF: ::std::os::raw::c_uint = 12; +pub const _PC_FILESIZEBITS: ::std::os::raw::c_uint = 13; +pub const _PC_REC_INCR_XFER_SIZE: ::std::os::raw::c_uint = 14; +pub const _PC_REC_MAX_XFER_SIZE: ::std::os::raw::c_uint = 15; +pub const _PC_REC_MIN_XFER_SIZE: ::std::os::raw::c_uint = 16; +pub const _PC_REC_XFER_ALIGN: ::std::os::raw::c_uint = 17; +pub const _PC_ALLOC_SIZE_MIN: ::std::os::raw::c_uint = 18; +pub const _PC_SYMLINK_MAX: ::std::os::raw::c_uint = 19; +pub const _PC_2_SYMLINKS: ::std::os::raw::c_uint = 20; +pub type _bindgen_ty_11 = ::std::os::raw::c_uint; +pub const _SC_ARG_MAX: ::std::os::raw::c_uint = 0; +pub const _SC_CHILD_MAX: ::std::os::raw::c_uint = 1; +pub const _SC_CLK_TCK: ::std::os::raw::c_uint = 2; +pub const _SC_NGROUPS_MAX: ::std::os::raw::c_uint = 3; +pub const _SC_OPEN_MAX: ::std::os::raw::c_uint = 4; +pub const _SC_STREAM_MAX: ::std::os::raw::c_uint = 5; +pub const _SC_TZNAME_MAX: ::std::os::raw::c_uint = 6; +pub const _SC_JOB_CONTROL: ::std::os::raw::c_uint = 7; +pub const _SC_SAVED_IDS: ::std::os::raw::c_uint = 8; +pub const _SC_REALTIME_SIGNALS: ::std::os::raw::c_uint = 9; +pub const _SC_PRIORITY_SCHEDULING: ::std::os::raw::c_uint = 10; +pub const _SC_TIMERS: ::std::os::raw::c_uint = 11; +pub const _SC_ASYNCHRONOUS_IO: ::std::os::raw::c_uint = 12; +pub const _SC_PRIORITIZED_IO: ::std::os::raw::c_uint = 13; +pub const _SC_SYNCHRONIZED_IO: ::std::os::raw::c_uint = 14; +pub const _SC_FSYNC: ::std::os::raw::c_uint = 15; +pub const _SC_MAPPED_FILES: ::std::os::raw::c_uint = 16; +pub const _SC_MEMLOCK: ::std::os::raw::c_uint = 17; +pub const _SC_MEMLOCK_RANGE: ::std::os::raw::c_uint = 18; +pub const _SC_MEMORY_PROTECTION: ::std::os::raw::c_uint = 19; +pub const _SC_MESSAGE_PASSING: ::std::os::raw::c_uint = 20; +pub const _SC_SEMAPHORES: ::std::os::raw::c_uint = 21; +pub const _SC_SHARED_MEMORY_OBJECTS: ::std::os::raw::c_uint = 22; +pub const _SC_AIO_LISTIO_MAX: ::std::os::raw::c_uint = 23; +pub const _SC_AIO_MAX: ::std::os::raw::c_uint = 24; +pub const _SC_AIO_PRIO_DELTA_MAX: ::std::os::raw::c_uint = 25; +pub const _SC_DELAYTIMER_MAX: ::std::os::raw::c_uint = 26; +pub const _SC_MQ_OPEN_MAX: ::std::os::raw::c_uint = 27; +pub const _SC_MQ_PRIO_MAX: ::std::os::raw::c_uint = 28; +pub const _SC_VERSION: ::std::os::raw::c_uint = 29; +pub const _SC_PAGESIZE: ::std::os::raw::c_uint = 30; +pub const _SC_RTSIG_MAX: ::std::os::raw::c_uint = 31; +pub const _SC_SEM_NSEMS_MAX: ::std::os::raw::c_uint = 32; +pub const _SC_SEM_VALUE_MAX: ::std::os::raw::c_uint = 33; +pub const _SC_SIGQUEUE_MAX: ::std::os::raw::c_uint = 34; +pub const _SC_TIMER_MAX: ::std::os::raw::c_uint = 35; +pub const _SC_BC_BASE_MAX: ::std::os::raw::c_uint = 36; +pub const _SC_BC_DIM_MAX: ::std::os::raw::c_uint = 37; +pub const _SC_BC_SCALE_MAX: ::std::os::raw::c_uint = 38; +pub const _SC_BC_STRING_MAX: ::std::os::raw::c_uint = 39; +pub const _SC_COLL_WEIGHTS_MAX: ::std::os::raw::c_uint = 40; +pub const _SC_EQUIV_CLASS_MAX: ::std::os::raw::c_uint = 41; +pub const _SC_EXPR_NEST_MAX: ::std::os::raw::c_uint = 42; +pub const _SC_LINE_MAX: ::std::os::raw::c_uint = 43; +pub const _SC_RE_DUP_MAX: ::std::os::raw::c_uint = 44; +pub const _SC_CHARCLASS_NAME_MAX: ::std::os::raw::c_uint = 45; +pub const _SC_2_VERSION: ::std::os::raw::c_uint = 46; +pub const _SC_2_C_BIND: ::std::os::raw::c_uint = 47; +pub const _SC_2_C_DEV: ::std::os::raw::c_uint = 48; +pub const _SC_2_FORT_DEV: ::std::os::raw::c_uint = 49; +pub const _SC_2_FORT_RUN: ::std::os::raw::c_uint = 50; +pub const _SC_2_SW_DEV: ::std::os::raw::c_uint = 51; +pub const _SC_2_LOCALEDEF: ::std::os::raw::c_uint = 52; +pub const _SC_PII: ::std::os::raw::c_uint = 53; +pub const _SC_PII_XTI: ::std::os::raw::c_uint = 54; +pub const _SC_PII_SOCKET: ::std::os::raw::c_uint = 55; +pub const _SC_PII_INTERNET: ::std::os::raw::c_uint = 56; +pub const _SC_PII_OSI: ::std::os::raw::c_uint = 57; +pub const _SC_POLL: ::std::os::raw::c_uint = 58; +pub const _SC_SELECT: ::std::os::raw::c_uint = 59; +pub const _SC_UIO_MAXIOV: ::std::os::raw::c_uint = 60; +pub const _SC_IOV_MAX: ::std::os::raw::c_uint = 60; +pub const _SC_PII_INTERNET_STREAM: ::std::os::raw::c_uint = 61; +pub const _SC_PII_INTERNET_DGRAM: ::std::os::raw::c_uint = 62; +pub const _SC_PII_OSI_COTS: ::std::os::raw::c_uint = 63; +pub const _SC_PII_OSI_CLTS: ::std::os::raw::c_uint = 64; +pub const _SC_PII_OSI_M: ::std::os::raw::c_uint = 65; +pub const _SC_T_IOV_MAX: ::std::os::raw::c_uint = 66; +pub const _SC_THREADS: ::std::os::raw::c_uint = 67; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::std::os::raw::c_uint = 68; +pub const _SC_GETGR_R_SIZE_MAX: ::std::os::raw::c_uint = 69; +pub const _SC_GETPW_R_SIZE_MAX: ::std::os::raw::c_uint = 70; +pub const _SC_LOGIN_NAME_MAX: ::std::os::raw::c_uint = 71; +pub const _SC_TTY_NAME_MAX: ::std::os::raw::c_uint = 72; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::std::os::raw::c_uint = 73; +pub const _SC_THREAD_KEYS_MAX: ::std::os::raw::c_uint = 74; +pub const _SC_THREAD_STACK_MIN: ::std::os::raw::c_uint = 75; +pub const _SC_THREAD_THREADS_MAX: ::std::os::raw::c_uint = 76; +pub const _SC_THREAD_ATTR_STACKADDR: ::std::os::raw::c_uint = 77; +pub const _SC_THREAD_ATTR_STACKSIZE: ::std::os::raw::c_uint = 78; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::std::os::raw::c_uint = 79; +pub const _SC_THREAD_PRIO_INHERIT: ::std::os::raw::c_uint = 80; +pub const _SC_THREAD_PRIO_PROTECT: ::std::os::raw::c_uint = 81; +pub const _SC_THREAD_PROCESS_SHARED: ::std::os::raw::c_uint = 82; +pub const _SC_NPROCESSORS_CONF: ::std::os::raw::c_uint = 83; +pub const _SC_NPROCESSORS_ONLN: ::std::os::raw::c_uint = 84; +pub const _SC_PHYS_PAGES: ::std::os::raw::c_uint = 85; +pub const _SC_AVPHYS_PAGES: ::std::os::raw::c_uint = 86; +pub const _SC_ATEXIT_MAX: ::std::os::raw::c_uint = 87; +pub const _SC_PASS_MAX: ::std::os::raw::c_uint = 88; +pub const _SC_XOPEN_VERSION: ::std::os::raw::c_uint = 89; +pub const _SC_XOPEN_XCU_VERSION: ::std::os::raw::c_uint = 90; +pub const _SC_XOPEN_UNIX: ::std::os::raw::c_uint = 91; +pub const _SC_XOPEN_CRYPT: ::std::os::raw::c_uint = 92; +pub const _SC_XOPEN_ENH_I18N: ::std::os::raw::c_uint = 93; +pub const _SC_XOPEN_SHM: ::std::os::raw::c_uint = 94; +pub const _SC_2_CHAR_TERM: ::std::os::raw::c_uint = 95; +pub const _SC_2_C_VERSION: ::std::os::raw::c_uint = 96; +pub const _SC_2_UPE: ::std::os::raw::c_uint = 97; +pub const _SC_XOPEN_XPG2: ::std::os::raw::c_uint = 98; +pub const _SC_XOPEN_XPG3: ::std::os::raw::c_uint = 99; +pub const _SC_XOPEN_XPG4: ::std::os::raw::c_uint = 100; +pub const _SC_CHAR_BIT: ::std::os::raw::c_uint = 101; +pub const _SC_CHAR_MAX: ::std::os::raw::c_uint = 102; +pub const _SC_CHAR_MIN: ::std::os::raw::c_uint = 103; +pub const _SC_INT_MAX: ::std::os::raw::c_uint = 104; +pub const _SC_INT_MIN: ::std::os::raw::c_uint = 105; +pub const _SC_LONG_BIT: ::std::os::raw::c_uint = 106; +pub const _SC_WORD_BIT: ::std::os::raw::c_uint = 107; +pub const _SC_MB_LEN_MAX: ::std::os::raw::c_uint = 108; +pub const _SC_NZERO: ::std::os::raw::c_uint = 109; +pub const _SC_SSIZE_MAX: ::std::os::raw::c_uint = 110; +pub const _SC_SCHAR_MAX: ::std::os::raw::c_uint = 111; +pub const _SC_SCHAR_MIN: ::std::os::raw::c_uint = 112; +pub const _SC_SHRT_MAX: ::std::os::raw::c_uint = 113; +pub const _SC_SHRT_MIN: ::std::os::raw::c_uint = 114; +pub const _SC_UCHAR_MAX: ::std::os::raw::c_uint = 115; +pub const _SC_UINT_MAX: ::std::os::raw::c_uint = 116; +pub const _SC_ULONG_MAX: ::std::os::raw::c_uint = 117; +pub const _SC_USHRT_MAX: ::std::os::raw::c_uint = 118; +pub const _SC_NL_ARGMAX: ::std::os::raw::c_uint = 119; +pub const _SC_NL_LANGMAX: ::std::os::raw::c_uint = 120; +pub const _SC_NL_MSGMAX: ::std::os::raw::c_uint = 121; +pub const _SC_NL_NMAX: ::std::os::raw::c_uint = 122; +pub const _SC_NL_SETMAX: ::std::os::raw::c_uint = 123; +pub const _SC_NL_TEXTMAX: ::std::os::raw::c_uint = 124; +pub const _SC_XBS5_ILP32_OFF32: ::std::os::raw::c_uint = 125; +pub const _SC_XBS5_ILP32_OFFBIG: ::std::os::raw::c_uint = 126; +pub const _SC_XBS5_LP64_OFF64: ::std::os::raw::c_uint = 127; +pub const _SC_XBS5_LPBIG_OFFBIG: ::std::os::raw::c_uint = 128; +pub const _SC_XOPEN_LEGACY: ::std::os::raw::c_uint = 129; +pub const _SC_XOPEN_REALTIME: ::std::os::raw::c_uint = 130; +pub const _SC_XOPEN_REALTIME_THREADS: ::std::os::raw::c_uint = 131; +pub const _SC_ADVISORY_INFO: ::std::os::raw::c_uint = 132; +pub const _SC_BARRIERS: ::std::os::raw::c_uint = 133; +pub const _SC_BASE: ::std::os::raw::c_uint = 134; +pub const _SC_C_LANG_SUPPORT: ::std::os::raw::c_uint = 135; +pub const _SC_C_LANG_SUPPORT_R: ::std::os::raw::c_uint = 136; +pub const _SC_CLOCK_SELECTION: ::std::os::raw::c_uint = 137; +pub const _SC_CPUTIME: ::std::os::raw::c_uint = 138; +pub const _SC_THREAD_CPUTIME: ::std::os::raw::c_uint = 139; +pub const _SC_DEVICE_IO: ::std::os::raw::c_uint = 140; +pub const _SC_DEVICE_SPECIFIC: ::std::os::raw::c_uint = 141; +pub const _SC_DEVICE_SPECIFIC_R: ::std::os::raw::c_uint = 142; +pub const _SC_FD_MGMT: ::std::os::raw::c_uint = 143; +pub const _SC_FIFO: ::std::os::raw::c_uint = 144; +pub const _SC_PIPE: ::std::os::raw::c_uint = 145; +pub const _SC_FILE_ATTRIBUTES: ::std::os::raw::c_uint = 146; +pub const _SC_FILE_LOCKING: ::std::os::raw::c_uint = 147; +pub const _SC_FILE_SYSTEM: ::std::os::raw::c_uint = 148; +pub const _SC_MONOTONIC_CLOCK: ::std::os::raw::c_uint = 149; +pub const _SC_MULTI_PROCESS: ::std::os::raw::c_uint = 150; +pub const _SC_SINGLE_PROCESS: ::std::os::raw::c_uint = 151; +pub const _SC_NETWORKING: ::std::os::raw::c_uint = 152; +pub const _SC_READER_WRITER_LOCKS: ::std::os::raw::c_uint = 153; +pub const _SC_SPIN_LOCKS: ::std::os::raw::c_uint = 154; +pub const _SC_REGEXP: ::std::os::raw::c_uint = 155; +pub const _SC_REGEX_VERSION: ::std::os::raw::c_uint = 156; +pub const _SC_SHELL: ::std::os::raw::c_uint = 157; +pub const _SC_SIGNALS: ::std::os::raw::c_uint = 158; +pub const _SC_SPAWN: ::std::os::raw::c_uint = 159; +pub const _SC_SPORADIC_SERVER: ::std::os::raw::c_uint = 160; +pub const _SC_THREAD_SPORADIC_SERVER: ::std::os::raw::c_uint = 161; +pub const _SC_SYSTEM_DATABASE: ::std::os::raw::c_uint = 162; +pub const _SC_SYSTEM_DATABASE_R: ::std::os::raw::c_uint = 163; +pub const _SC_TIMEOUTS: ::std::os::raw::c_uint = 164; +pub const _SC_TYPED_MEMORY_OBJECTS: ::std::os::raw::c_uint = 165; +pub const _SC_USER_GROUPS: ::std::os::raw::c_uint = 166; +pub const _SC_USER_GROUPS_R: ::std::os::raw::c_uint = 167; +pub const _SC_2_PBS: ::std::os::raw::c_uint = 168; +pub const _SC_2_PBS_ACCOUNTING: ::std::os::raw::c_uint = 169; +pub const _SC_2_PBS_LOCATE: ::std::os::raw::c_uint = 170; +pub const _SC_2_PBS_MESSAGE: ::std::os::raw::c_uint = 171; +pub const _SC_2_PBS_TRACK: ::std::os::raw::c_uint = 172; +pub const _SC_SYMLOOP_MAX: ::std::os::raw::c_uint = 173; +pub const _SC_STREAMS: ::std::os::raw::c_uint = 174; +pub const _SC_2_PBS_CHECKPOINT: ::std::os::raw::c_uint = 175; +pub const _SC_V6_ILP32_OFF32: ::std::os::raw::c_uint = 176; +pub const _SC_V6_ILP32_OFFBIG: ::std::os::raw::c_uint = 177; +pub const _SC_V6_LP64_OFF64: ::std::os::raw::c_uint = 178; +pub const _SC_V6_LPBIG_OFFBIG: ::std::os::raw::c_uint = 179; +pub const _SC_HOST_NAME_MAX: ::std::os::raw::c_uint = 180; +pub const _SC_TRACE: ::std::os::raw::c_uint = 181; +pub const _SC_TRACE_EVENT_FILTER: ::std::os::raw::c_uint = 182; +pub const _SC_TRACE_INHERIT: ::std::os::raw::c_uint = 183; +pub const _SC_TRACE_LOG: ::std::os::raw::c_uint = 184; +pub const _SC_LEVEL1_ICACHE_SIZE: ::std::os::raw::c_uint = 185; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::std::os::raw::c_uint = 186; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::std::os::raw::c_uint = 187; +pub const _SC_LEVEL1_DCACHE_SIZE: ::std::os::raw::c_uint = 188; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::std::os::raw::c_uint = 189; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::std::os::raw::c_uint = 190; +pub const _SC_LEVEL2_CACHE_SIZE: ::std::os::raw::c_uint = 191; +pub const _SC_LEVEL2_CACHE_ASSOC: ::std::os::raw::c_uint = 192; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::std::os::raw::c_uint = 193; +pub const _SC_LEVEL3_CACHE_SIZE: ::std::os::raw::c_uint = 194; +pub const _SC_LEVEL3_CACHE_ASSOC: ::std::os::raw::c_uint = 195; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::std::os::raw::c_uint = 196; +pub const _SC_LEVEL4_CACHE_SIZE: ::std::os::raw::c_uint = 197; +pub const _SC_LEVEL4_CACHE_ASSOC: ::std::os::raw::c_uint = 198; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::std::os::raw::c_uint = 199; +pub const _SC_IPV6: ::std::os::raw::c_uint = 235; +pub const _SC_RAW_SOCKETS: ::std::os::raw::c_uint = 236; +pub const _SC_V7_ILP32_OFF32: ::std::os::raw::c_uint = 237; +pub const _SC_V7_ILP32_OFFBIG: ::std::os::raw::c_uint = 238; +pub const _SC_V7_LP64_OFF64: ::std::os::raw::c_uint = 239; +pub const _SC_V7_LPBIG_OFFBIG: ::std::os::raw::c_uint = 240; +pub const _SC_SS_REPL_MAX: ::std::os::raw::c_uint = 241; +pub const _SC_TRACE_EVENT_NAME_MAX: ::std::os::raw::c_uint = 242; +pub const _SC_TRACE_NAME_MAX: ::std::os::raw::c_uint = 243; +pub const _SC_TRACE_SYS_MAX: ::std::os::raw::c_uint = 244; +pub const _SC_TRACE_USER_EVENT_MAX: ::std::os::raw::c_uint = 245; +pub const _SC_XOPEN_STREAMS: ::std::os::raw::c_uint = 246; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::std::os::raw::c_uint = 247; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::std::os::raw::c_uint = 248; +pub type _bindgen_ty_12 = ::std::os::raw::c_uint; +pub const _CS_PATH: ::std::os::raw::c_uint = 0; +pub const _CS_V6_WIDTH_RESTRICTED_ENVS: ::std::os::raw::c_uint = 1; +pub const _CS_GNU_LIBC_VERSION: ::std::os::raw::c_uint = 2; +pub const _CS_GNU_LIBPTHREAD_VERSION: ::std::os::raw::c_uint = 3; +pub const _CS_V5_WIDTH_RESTRICTED_ENVS: ::std::os::raw::c_uint = 4; +pub const _CS_V7_WIDTH_RESTRICTED_ENVS: ::std::os::raw::c_uint = 5; +pub const _CS_LFS_CFLAGS: ::std::os::raw::c_uint = 1000; +pub const _CS_LFS_LDFLAGS: ::std::os::raw::c_uint = 1001; +pub const _CS_LFS_LIBS: ::std::os::raw::c_uint = 1002; +pub const _CS_LFS_LINTFLAGS: ::std::os::raw::c_uint = 1003; +pub const _CS_LFS64_CFLAGS: ::std::os::raw::c_uint = 1004; +pub const _CS_LFS64_LDFLAGS: ::std::os::raw::c_uint = 1005; +pub const _CS_LFS64_LIBS: ::std::os::raw::c_uint = 1006; +pub const _CS_LFS64_LINTFLAGS: ::std::os::raw::c_uint = 1007; +pub const _CS_XBS5_ILP32_OFF32_CFLAGS: ::std::os::raw::c_uint = 1100; +pub const _CS_XBS5_ILP32_OFF32_LDFLAGS: ::std::os::raw::c_uint = 1101; +pub const _CS_XBS5_ILP32_OFF32_LIBS: ::std::os::raw::c_uint = 1102; +pub const _CS_XBS5_ILP32_OFF32_LINTFLAGS: ::std::os::raw::c_uint = 1103; +pub const _CS_XBS5_ILP32_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1104; +pub const _CS_XBS5_ILP32_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1105; +pub const _CS_XBS5_ILP32_OFFBIG_LIBS: ::std::os::raw::c_uint = 1106; +pub const _CS_XBS5_ILP32_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1107; +pub const _CS_XBS5_LP64_OFF64_CFLAGS: ::std::os::raw::c_uint = 1108; +pub const _CS_XBS5_LP64_OFF64_LDFLAGS: ::std::os::raw::c_uint = 1109; +pub const _CS_XBS5_LP64_OFF64_LIBS: ::std::os::raw::c_uint = 1110; +pub const _CS_XBS5_LP64_OFF64_LINTFLAGS: ::std::os::raw::c_uint = 1111; +pub const _CS_XBS5_LPBIG_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1112; +pub const _CS_XBS5_LPBIG_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1113; +pub const _CS_XBS5_LPBIG_OFFBIG_LIBS: ::std::os::raw::c_uint = 1114; +pub const _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1115; +pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: ::std::os::raw::c_uint = 1116; +pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: ::std::os::raw::c_uint = 1117; +pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: ::std::os::raw::c_uint = 1118; +pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: ::std::os::raw::c_uint = 1119; +pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1120; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1121; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: ::std::os::raw::c_uint = 1122; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1123; +pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: ::std::os::raw::c_uint = 1124; +pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: ::std::os::raw::c_uint = 1125; +pub const _CS_POSIX_V6_LP64_OFF64_LIBS: ::std::os::raw::c_uint = 1126; +pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: ::std::os::raw::c_uint = 1127; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1128; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1129; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: ::std::os::raw::c_uint = 1130; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1131; +pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: ::std::os::raw::c_uint = 1132; +pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: ::std::os::raw::c_uint = 1133; +pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: ::std::os::raw::c_uint = 1134; +pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: ::std::os::raw::c_uint = 1135; +pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1136; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1137; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: ::std::os::raw::c_uint = 1138; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1139; +pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: ::std::os::raw::c_uint = 1140; +pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: ::std::os::raw::c_uint = 1141; +pub const _CS_POSIX_V7_LP64_OFF64_LIBS: ::std::os::raw::c_uint = 1142; +pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: ::std::os::raw::c_uint = 1143; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: ::std::os::raw::c_uint = 1144; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: ::std::os::raw::c_uint = 1145; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: ::std::os::raw::c_uint = 1146; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: ::std::os::raw::c_uint = 1147; +pub const _CS_V6_ENV: ::std::os::raw::c_uint = 1148; +pub const _CS_V7_ENV: ::std::os::raw::c_uint = 1149; +pub type _bindgen_ty_13 = ::std::os::raw::c_uint; +extern "C" { + pub fn pathconf( + __path: *const ::std::os::raw::c_char, + __name: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn fpathconf( + __fd: ::std::os::raw::c_int, + __name: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn sysconf(__name: ::std::os::raw::c_int) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn confstr( + __name: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> usize; +} +extern "C" { + pub fn getpid() -> __pid_t; +} +extern "C" { + pub fn getppid() -> __pid_t; +} +extern "C" { + pub fn getpgrp() -> __pid_t; +} +extern "C" { + pub fn __getpgid(__pid: __pid_t) -> __pid_t; +} +extern "C" { + pub fn getpgid(__pid: __pid_t) -> __pid_t; +} +extern "C" { + pub fn setpgid(__pid: __pid_t, __pgid: __pid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setpgrp() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setsid() -> __pid_t; +} +extern "C" { + pub fn getsid(__pid: __pid_t) -> __pid_t; +} +extern "C" { + pub fn getuid() -> __uid_t; +} +extern "C" { + pub fn geteuid() -> __uid_t; +} +extern "C" { + pub fn getgid() -> __gid_t; +} +extern "C" { + pub fn getegid() -> __gid_t; +} +extern "C" { + pub fn getgroups(__size: ::std::os::raw::c_int, __list: *mut __gid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setuid(__uid: __uid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setreuid(__ruid: __uid_t, __euid: __uid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn seteuid(__uid: __uid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setgid(__gid: __gid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setregid(__rgid: __gid_t, __egid: __gid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setegid(__gid: __gid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fork() -> __pid_t; +} +extern "C" { + pub fn vfork() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ttyname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ttyname_r( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __buflen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isatty(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ttyslot() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn link( + __from: *const ::std::os::raw::c_char, + __to: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn linkat( + __fromfd: ::std::os::raw::c_int, + __from: *const ::std::os::raw::c_char, + __tofd: ::std::os::raw::c_int, + __to: *const ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn symlink( + __from: *const ::std::os::raw::c_char, + __to: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn readlink( + __path: *const ::std::os::raw::c_char, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> isize; +} +extern "C" { + pub fn symlinkat( + __from: *const ::std::os::raw::c_char, + __tofd: ::std::os::raw::c_int, + __to: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn readlinkat( + __fd: ::std::os::raw::c_int, + __path: *const ::std::os::raw::c_char, + __buf: *mut ::std::os::raw::c_char, + __len: usize, + ) -> isize; +} +extern "C" { + pub fn unlink(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unlinkat( + __fd: ::std::os::raw::c_int, + __name: *const ::std::os::raw::c_char, + __flag: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rmdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tcgetpgrp(__fd: ::std::os::raw::c_int) -> __pid_t; +} +extern "C" { + pub fn tcsetpgrp(__fd: ::std::os::raw::c_int, __pgrp_id: __pid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getlogin() -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getlogin_r( + __name: *mut ::std::os::raw::c_char, + __name_len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setlogin(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getopt( + ___argc: ::std::os::raw::c_int, + ___argv: *const *mut ::std::os::raw::c_char, + __shortopts: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostname(__name: *mut ::std::os::raw::c_char, __len: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sethostname( + __name: *const ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sethostid(__id: ::std::os::raw::c_long) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdomainname( + __name: *mut ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setdomainname( + __name: *const ::std::os::raw::c_char, + __len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vhangup() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn revoke(__file: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn profil( + __sample_buffer: *mut ::std::os::raw::c_ushort, + __size: usize, + __offset: usize, + __scale: ::std::os::raw::c_uint, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn acct(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getusershell() -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn endusershell(); +} +extern "C" { + pub fn setusershell(); +} +extern "C" { + pub fn daemon( + __nochdir: ::std::os::raw::c_int, + __noclose: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn chroot(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpass(__prompt: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fsync(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostid() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn sync(); +} +extern "C" { + pub fn getpagesize() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdtablesize() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn truncate( + __file: *const ::std::os::raw::c_char, + __length: __off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftruncate(__fd: ::std::os::raw::c_int, __length: __off_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn brk(__addr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sbrk(__delta: isize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn syscall(__sysno: ::std::os::raw::c_long, ...) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lockf( + __fd: ::std::os::raw::c_int, + __cmd: ::std::os::raw::c_int, + __len: __off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fdatasync(__fildes: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn crypt( + __key: *const ::std::os::raw::c_char, + __salt: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getentropy( + __buffer: *mut ::std::os::raw::c_void, + __length: usize, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct qb_array { + _unused: [u8; 0], +} +pub type qb_array_t = qb_array; +extern "C" { + pub fn qb_array_create(max_elements: usize, element_size: usize) -> *mut qb_array_t; +} +extern "C" { + pub fn qb_array_create_2( + max_elements: usize, + element_size: usize, + autogrow_elements: usize, + ) -> *mut qb_array_t; +} +extern "C" { + pub fn qb_array_index( + a: *mut qb_array_t, + idx: i32, + element_out: *mut *mut ::std::os::raw::c_void, + ) -> i32; +} +extern "C" { + pub fn qb_array_grow(a: *mut qb_array_t, max_elements: usize) -> i32; +} +extern "C" { + pub fn qb_array_num_bins_get(a: *mut qb_array_t) -> usize; +} +extern "C" { + pub fn qb_array_elems_per_bin_get(a: *mut qb_array_t) -> usize; +} +pub type qb_array_new_bin_cb_fn = + ::std::option::Option; +extern "C" { + pub fn qb_array_new_bin_cb_set(a: *mut qb_array_t, fn_: qb_array_new_bin_cb_fn) -> i32; +} +extern "C" { + pub fn qb_array_free(a: *mut qb_array_t); +} +pub type qb_handle_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct qb_hdb_handle { + pub state: i32, + pub instance: *mut ::std::os::raw::c_void, + pub check: i32, + pub ref_count: i32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct qb_hdb { + pub handle_count: u32, + pub handles: *mut qb_array_t, + pub iterator: u32, + pub destructor: ::std::option::Option, + pub first_run: u32, +} +extern "C" { + pub fn qb_hdb_create(hdb: *mut qb_hdb); +} +extern "C" { + pub fn qb_hdb_destroy(hdb: *mut qb_hdb); +} +extern "C" { + pub fn qb_hdb_handle_create( + hdb: *mut qb_hdb, + instance_size: i32, + handle_id_out: *mut qb_handle_t, + ) -> i32; +} +extern "C" { + pub fn qb_hdb_handle_get( + hdb: *mut qb_hdb, + handle_in: qb_handle_t, + instance: *mut *mut ::std::os::raw::c_void, + ) -> i32; +} +extern "C" { + pub fn qb_hdb_handle_get_always( + hdb: *mut qb_hdb, + handle_in: qb_handle_t, + instance: *mut *mut ::std::os::raw::c_void, + ) -> i32; +} +extern "C" { + pub fn qb_hdb_handle_put(hdb: *mut qb_hdb, handle_in: qb_handle_t) -> i32; +} +extern "C" { + pub fn qb_hdb_handle_destroy(hdb: *mut qb_hdb, handle_in: qb_handle_t) -> i32; +} +extern "C" { + pub fn qb_hdb_handle_refcount_get(hdb: *mut qb_hdb, handle_in: qb_handle_t) -> i32; +} +extern "C" { + pub fn qb_hdb_iterator_reset(hdb: *mut qb_hdb); +} +extern "C" { + pub fn qb_hdb_iterator_next( + hdb: *mut qb_hdb, + instance: *mut *mut ::std::os::raw::c_void, + handle: *mut qb_handle_t, + ) -> i32; +} +extern "C" { + pub fn qb_hdb_base_convert(handle: qb_handle_t) -> u32; +} +extern "C" { + pub fn qb_hdb_nocheck_convert(handle: u32) -> u64; +} +pub type hdb_handle_t = qb_handle_t; +pub type cmap_handle_t = u64; +pub type cmap_iter_handle_t = u64; +pub type cmap_track_handle_t = u64; +pub const CMAP_VALUETYPE_INT8: cmap_value_types_t = 1; +pub const CMAP_VALUETYPE_UINT8: cmap_value_types_t = 2; +pub const CMAP_VALUETYPE_INT16: cmap_value_types_t = 3; +pub const CMAP_VALUETYPE_UINT16: cmap_value_types_t = 4; +pub const CMAP_VALUETYPE_INT32: cmap_value_types_t = 5; +pub const CMAP_VALUETYPE_UINT32: cmap_value_types_t = 6; +pub const CMAP_VALUETYPE_INT64: cmap_value_types_t = 7; +pub const CMAP_VALUETYPE_UINT64: cmap_value_types_t = 8; +pub const CMAP_VALUETYPE_FLOAT: cmap_value_types_t = 9; +pub const CMAP_VALUETYPE_DOUBLE: cmap_value_types_t = 10; +pub const CMAP_VALUETYPE_STRING: cmap_value_types_t = 11; +pub const CMAP_VALUETYPE_BINARY: cmap_value_types_t = 12; +pub type cmap_value_types_t = ::std::os::raw::c_uint; +pub const CMAP_MAP_DEFAULT: cmap_map_t = 0; +pub const CMAP_MAP_ICMAP: cmap_map_t = 0; +pub const CMAP_MAP_STATS: cmap_map_t = 1; +pub type cmap_map_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmap_notify_value { + pub type_: cmap_value_types_t, + pub len: usize, + pub data: *const ::std::os::raw::c_void, +} +pub type cmap_notify_fn_t = ::std::option::Option< + unsafe extern "C" fn( + cmap_handle: cmap_handle_t, + cmap_track_handle: cmap_track_handle_t, + event: i32, + key_name: *const ::std::os::raw::c_char, + new_value: cmap_notify_value, + old_value: cmap_notify_value, + user_data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + pub fn cmap_initialize(handle: *mut cmap_handle_t) -> cs_error_t; +} +extern "C" { + pub fn cmap_initialize_map(handle: *mut cmap_handle_t, map: cmap_map_t) -> cs_error_t; +} +extern "C" { + pub fn cmap_finalize(handle: cmap_handle_t) -> cs_error_t; +} +extern "C" { + pub fn cmap_fd_get(handle: cmap_handle_t, fd: *mut ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cmap_dispatch(handle: cmap_handle_t, dispatch_types: cs_dispatch_flags_t) -> cs_error_t; +} +extern "C" { + pub fn cmap_context_get( + handle: cmap_handle_t, + context: *mut *const ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_context_set( + handle: cmap_handle_t, + context: *const ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_void, + value_len: usize, + type_: cmap_value_types_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_int8( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: i8, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_uint8( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: u8, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_int16( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: i16, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_uint16( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: u16, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_int32( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: i32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_uint32( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: u32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_int64( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: i64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_uint64( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: u64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_float( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: f32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_double( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: f64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_set_string( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_delete( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + value: *mut ::std::os::raw::c_void, + value_len: *mut usize, + type_: *mut cmap_value_types_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_int8( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + i8_: *mut i8, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_uint8( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + u8_: *mut u8, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_int16( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + i16_: *mut i16, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_uint16( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + u16_: *mut u16, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_int32( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + i32_: *mut i32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_uint32( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + u32_: *mut u32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_int64( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + i64_: *mut i64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_uint64( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + u64_: *mut u64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_float( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + flt: *mut f32, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_double( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + dbl: *mut f64, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_get_string( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + str_: *mut *mut ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_inc(handle: cmap_handle_t, key_name: *const ::std::os::raw::c_char) -> cs_error_t; +} +extern "C" { + pub fn cmap_dec(handle: cmap_handle_t, key_name: *const ::std::os::raw::c_char) -> cs_error_t; +} +extern "C" { + pub fn cmap_iter_init( + handle: cmap_handle_t, + prefix: *const ::std::os::raw::c_char, + cmap_iter_handle: *mut cmap_iter_handle_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_iter_next( + handle: cmap_handle_t, + iter_handle: cmap_iter_handle_t, + key_name: *mut ::std::os::raw::c_char, + value_len: *mut usize, + type_: *mut cmap_value_types_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_iter_finalize(handle: cmap_handle_t, iter_handle: cmap_iter_handle_t) + -> cs_error_t; +} +extern "C" { + pub fn cmap_track_add( + handle: cmap_handle_t, + key_name: *const ::std::os::raw::c_char, + track_type: i32, + notify_fn: cmap_notify_fn_t, + user_data: *mut ::std::os::raw::c_void, + cmap_track_handle: *mut cmap_track_handle_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cmap_track_delete( + handle: cmap_handle_t, + track_handle: cmap_track_handle_t, + ) -> cs_error_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cpg.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cpg.rs new file mode 100644 index 00000000..09c84c9e --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/cpg.rs @@ -0,0 +1,1310 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: usize, +} +pub type u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type pid_t = __pid_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type clock_t = __clock_t; +pub type clockid_t = __clockid_t; +pub type time_t = __time_t; +pub type timer_t = __timer_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +pub type sigset_t = __sigset_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +pub type suseconds_t = __suseconds_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __bindgen_anon_1: __pthread_cond_s__bindgen_ty_1, + pub __bindgen_anon_2: __pthread_cond_s__bindgen_ty_2, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_1 { + pub __wseq: ::std::os::raw::c_ulonglong, + pub __wseq32: __pthread_cond_s__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_1__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __pthread_cond_s__bindgen_ty_2 { + pub __g1_start: ::std::os::raw::c_ulonglong, + pub __g1_start32: __pthread_cond_s__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: u64, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_cond_s__bindgen_ty_2__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 5usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, + _bindgen_union_align: [u64; 6usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 7usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: u64, +} +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, + _bindgen_union_align: [u64; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, + _bindgen_union_align: u32, +} +pub type socklen_t = __socklen_t; +pub const SOCK_STREAM: __socket_type = 1; +pub const SOCK_DGRAM: __socket_type = 2; +pub const SOCK_RAW: __socket_type = 3; +pub const SOCK_RDM: __socket_type = 4; +pub const SOCK_SEQPACKET: __socket_type = 5; +pub const SOCK_DCCP: __socket_type = 6; +pub const SOCK_PACKET: __socket_type = 10; +pub const SOCK_CLOEXEC: __socket_type = 524288; +pub const SOCK_NONBLOCK: __socket_type = 2048; +pub type __socket_type = ::std::os::raw::c_uint; +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: sa_family_t, + pub __ss_padding: [::std::os::raw::c_char; 118usize], + pub __ss_align: ::std::os::raw::c_ulong, +} +pub const MSG_OOB: ::std::os::raw::c_uint = 1; +pub const MSG_PEEK: ::std::os::raw::c_uint = 2; +pub const MSG_DONTROUTE: ::std::os::raw::c_uint = 4; +pub const MSG_CTRUNC: ::std::os::raw::c_uint = 8; +pub const MSG_PROXY: ::std::os::raw::c_uint = 16; +pub const MSG_TRUNC: ::std::os::raw::c_uint = 32; +pub const MSG_DONTWAIT: ::std::os::raw::c_uint = 64; +pub const MSG_EOR: ::std::os::raw::c_uint = 128; +pub const MSG_WAITALL: ::std::os::raw::c_uint = 256; +pub const MSG_FIN: ::std::os::raw::c_uint = 512; +pub const MSG_SYN: ::std::os::raw::c_uint = 1024; +pub const MSG_CONFIRM: ::std::os::raw::c_uint = 2048; +pub const MSG_RST: ::std::os::raw::c_uint = 4096; +pub const MSG_ERRQUEUE: ::std::os::raw::c_uint = 8192; +pub const MSG_NOSIGNAL: ::std::os::raw::c_uint = 16384; +pub const MSG_MORE: ::std::os::raw::c_uint = 32768; +pub const MSG_WAITFORONE: ::std::os::raw::c_uint = 65536; +pub const MSG_BATCH: ::std::os::raw::c_uint = 262144; +pub const MSG_ZEROCOPY: ::std::os::raw::c_uint = 67108864; +pub const MSG_FASTOPEN: ::std::os::raw::c_uint = 536870912; +pub const MSG_CMSG_CLOEXEC: ::std::os::raw::c_uint = 1073741824; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, + pub __cmsg_data: __IncompleteArrayField<::std::os::raw::c_uchar>, +} +extern "C" { + pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +pub const SCM_RIGHTS: ::std::os::raw::c_uint = 1; +pub type _bindgen_ty_2 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct osockaddr { + pub sa_family: ::std::os::raw::c_ushort, + pub sa_data: [::std::os::raw::c_uchar; 14usize], +} +pub const SHUT_RD: ::std::os::raw::c_uint = 0; +pub const SHUT_WR: ::std::os::raw::c_uint = 1; +pub const SHUT_RDWR: ::std::os::raw::c_uint = 2; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +extern "C" { + pub fn socket( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_len: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> isize; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __message: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __message: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *mut ::std::os::raw::c_void, + __optlen: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *const ::std::os::raw::c_void, + __optlen: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen(__fd: ::std::os::raw::c_int, __n: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sockatmark(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isfdtype( + __fd: ::std::os::raw::c_int, + __fdtype: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub type in_addr_t = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_addr { + pub s_addr: in_addr_t, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ip_opts { + pub ip_dst: in_addr, + pub ip_opts: [::std::os::raw::c_char; 40usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreqn { + pub imr_multiaddr: in_addr, + pub imr_address: in_addr, + pub imr_ifindex: ::std::os::raw::c_int, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_pktinfo { + pub ipi_ifindex: ::std::os::raw::c_int, + pub ipi_spec_dst: in_addr, + pub ipi_addr: in_addr, +} +pub const IPPROTO_IP: ::std::os::raw::c_uint = 0; +pub const IPPROTO_ICMP: ::std::os::raw::c_uint = 1; +pub const IPPROTO_IGMP: ::std::os::raw::c_uint = 2; +pub const IPPROTO_IPIP: ::std::os::raw::c_uint = 4; +pub const IPPROTO_TCP: ::std::os::raw::c_uint = 6; +pub const IPPROTO_EGP: ::std::os::raw::c_uint = 8; +pub const IPPROTO_PUP: ::std::os::raw::c_uint = 12; +pub const IPPROTO_UDP: ::std::os::raw::c_uint = 17; +pub const IPPROTO_IDP: ::std::os::raw::c_uint = 22; +pub const IPPROTO_TP: ::std::os::raw::c_uint = 29; +pub const IPPROTO_DCCP: ::std::os::raw::c_uint = 33; +pub const IPPROTO_IPV6: ::std::os::raw::c_uint = 41; +pub const IPPROTO_RSVP: ::std::os::raw::c_uint = 46; +pub const IPPROTO_GRE: ::std::os::raw::c_uint = 47; +pub const IPPROTO_ESP: ::std::os::raw::c_uint = 50; +pub const IPPROTO_AH: ::std::os::raw::c_uint = 51; +pub const IPPROTO_MTP: ::std::os::raw::c_uint = 92; +pub const IPPROTO_BEETPH: ::std::os::raw::c_uint = 94; +pub const IPPROTO_ENCAP: ::std::os::raw::c_uint = 98; +pub const IPPROTO_PIM: ::std::os::raw::c_uint = 103; +pub const IPPROTO_COMP: ::std::os::raw::c_uint = 108; +pub const IPPROTO_SCTP: ::std::os::raw::c_uint = 132; +pub const IPPROTO_UDPLITE: ::std::os::raw::c_uint = 136; +pub const IPPROTO_MPLS: ::std::os::raw::c_uint = 137; +pub const IPPROTO_ETHERNET: ::std::os::raw::c_uint = 143; +pub const IPPROTO_RAW: ::std::os::raw::c_uint = 255; +pub const IPPROTO_MPTCP: ::std::os::raw::c_uint = 262; +pub const IPPROTO_MAX: ::std::os::raw::c_uint = 263; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +pub const IPPROTO_HOPOPTS: ::std::os::raw::c_uint = 0; +pub const IPPROTO_ROUTING: ::std::os::raw::c_uint = 43; +pub const IPPROTO_FRAGMENT: ::std::os::raw::c_uint = 44; +pub const IPPROTO_ICMPV6: ::std::os::raw::c_uint = 58; +pub const IPPROTO_NONE: ::std::os::raw::c_uint = 59; +pub const IPPROTO_DSTOPTS: ::std::os::raw::c_uint = 60; +pub const IPPROTO_MH: ::std::os::raw::c_uint = 135; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; +pub type in_port_t = u16; +pub const IPPORT_ECHO: ::std::os::raw::c_uint = 7; +pub const IPPORT_DISCARD: ::std::os::raw::c_uint = 9; +pub const IPPORT_SYSTAT: ::std::os::raw::c_uint = 11; +pub const IPPORT_DAYTIME: ::std::os::raw::c_uint = 13; +pub const IPPORT_NETSTAT: ::std::os::raw::c_uint = 15; +pub const IPPORT_FTP: ::std::os::raw::c_uint = 21; +pub const IPPORT_TELNET: ::std::os::raw::c_uint = 23; +pub const IPPORT_SMTP: ::std::os::raw::c_uint = 25; +pub const IPPORT_TIMESERVER: ::std::os::raw::c_uint = 37; +pub const IPPORT_NAMESERVER: ::std::os::raw::c_uint = 42; +pub const IPPORT_WHOIS: ::std::os::raw::c_uint = 43; +pub const IPPORT_MTP: ::std::os::raw::c_uint = 57; +pub const IPPORT_TFTP: ::std::os::raw::c_uint = 69; +pub const IPPORT_RJE: ::std::os::raw::c_uint = 77; +pub const IPPORT_FINGER: ::std::os::raw::c_uint = 79; +pub const IPPORT_TTYLINK: ::std::os::raw::c_uint = 87; +pub const IPPORT_SUPDUP: ::std::os::raw::c_uint = 95; +pub const IPPORT_EXECSERVER: ::std::os::raw::c_uint = 512; +pub const IPPORT_LOGINSERVER: ::std::os::raw::c_uint = 513; +pub const IPPORT_CMDSERVER: ::std::os::raw::c_uint = 514; +pub const IPPORT_EFSSERVER: ::std::os::raw::c_uint = 520; +pub const IPPORT_BIFFUDP: ::std::os::raw::c_uint = 512; +pub const IPPORT_WHOSERVER: ::std::os::raw::c_uint = 513; +pub const IPPORT_ROUTESERVER: ::std::os::raw::c_uint = 520; +pub const IPPORT_RESERVED: ::std::os::raw::c_uint = 1024; +pub const IPPORT_USERRESERVED: ::std::os::raw::c_uint = 5000; +pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct in6_addr { + pub __in6_u: in6_addr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union in6_addr__bindgen_ty_1 { + pub __u6_addr8: [u8; 16usize], + pub __u6_addr16: [u16; 8usize], + pub __u6_addr32: [u32; 4usize], + _bindgen_union_align: [u32; 4usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [::std::os::raw::c_uchar; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + pub ipv6mr_interface: ::std::os::raw::c_uint, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_req { + pub gr_interface: u32, + pub gr_group: sockaddr_storage, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: sockaddr_storage, + pub gsr_source: sockaddr_storage, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_msfilter { + pub imsf_multiaddr: in_addr, + pub imsf_interface: in_addr, + pub imsf_fmode: u32, + pub imsf_numsrc: u32, + pub imsf_slist: [in_addr; 1usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct group_filter { + pub gf_interface: u32, + pub gf_group: sockaddr_storage, + pub gf_fmode: u32, + pub gf_numsrc: u32, + pub gf_slist: [sockaddr_storage; 1usize], +} +extern "C" { + pub fn ntohl(__netlong: u32) -> u32; +} +extern "C" { + pub fn ntohs(__netshort: u16) -> u16; +} +extern "C" { + pub fn htonl(__hostlong: u32) -> u32; +} +extern "C" { + pub fn htons(__hostshort: u16) -> u16; +} +extern "C" { + pub fn bindresvport( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bindresvport6( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in6, + ) -> ::std::os::raw::c_int; +} +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +extern "C" { + pub fn __errno_location() -> *mut ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +extern "C" { + pub fn gettimeofday( + __tv: *mut timeval, + __tz: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn settimeofday(__tv: *const timeval, __tz: *const timezone) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn adjtime(__delta: *const timeval, __olddelta: *mut timeval) -> ::std::os::raw::c_int; +} +pub const ITIMER_REAL: __itimer_which = 0; +pub const ITIMER_VIRTUAL: __itimer_which = 1; +pub const ITIMER_PROF: __itimer_which = 2; +pub type __itimer_which = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, +} +pub type __itimer_which_t = ::std::os::raw::c_int; +extern "C" { + pub fn getitimer(__which: __itimer_which_t, __value: *mut itimerval) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setitimer( + __which: __itimer_which_t, + __new: *const itimerval, + __old: *mut itimerval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn utimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lutimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn futimes(__fd: ::std::os::raw::c_int, __tvp: *const timeval) -> ::std::os::raw::c_int; +} +pub type cs_time_t = i64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cs_name_t { + pub length: u16, + pub value: [u8; 256usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cs_version_t { + pub releaseCode: ::std::os::raw::c_char, + pub majorVersion: ::std::os::raw::c_uchar, + pub minorVersion: ::std::os::raw::c_uchar, +} +pub const CS_DISPATCH_ONE: cs_dispatch_flags_t = 1; +pub const CS_DISPATCH_ALL: cs_dispatch_flags_t = 2; +pub const CS_DISPATCH_BLOCKING: cs_dispatch_flags_t = 3; +pub const CS_DISPATCH_ONE_NONBLOCKING: cs_dispatch_flags_t = 4; +pub type cs_dispatch_flags_t = ::std::os::raw::c_uint; +pub const CS_OK: cs_error_t = 1; +pub const CS_ERR_LIBRARY: cs_error_t = 2; +pub const CS_ERR_VERSION: cs_error_t = 3; +pub const CS_ERR_INIT: cs_error_t = 4; +pub const CS_ERR_TIMEOUT: cs_error_t = 5; +pub const CS_ERR_TRY_AGAIN: cs_error_t = 6; +pub const CS_ERR_INVALID_PARAM: cs_error_t = 7; +pub const CS_ERR_NO_MEMORY: cs_error_t = 8; +pub const CS_ERR_BAD_HANDLE: cs_error_t = 9; +pub const CS_ERR_BUSY: cs_error_t = 10; +pub const CS_ERR_ACCESS: cs_error_t = 11; +pub const CS_ERR_NOT_EXIST: cs_error_t = 12; +pub const CS_ERR_NAME_TOO_LONG: cs_error_t = 13; +pub const CS_ERR_EXIST: cs_error_t = 14; +pub const CS_ERR_NO_SPACE: cs_error_t = 15; +pub const CS_ERR_INTERRUPT: cs_error_t = 16; +pub const CS_ERR_NAME_NOT_FOUND: cs_error_t = 17; +pub const CS_ERR_NO_RESOURCES: cs_error_t = 18; +pub const CS_ERR_NOT_SUPPORTED: cs_error_t = 19; +pub const CS_ERR_BAD_OPERATION: cs_error_t = 20; +pub const CS_ERR_FAILED_OPERATION: cs_error_t = 21; +pub const CS_ERR_MESSAGE_ERROR: cs_error_t = 22; +pub const CS_ERR_QUEUE_FULL: cs_error_t = 23; +pub const CS_ERR_QUEUE_NOT_AVAILABLE: cs_error_t = 24; +pub const CS_ERR_BAD_FLAGS: cs_error_t = 25; +pub const CS_ERR_TOO_BIG: cs_error_t = 26; +pub const CS_ERR_NO_SECTIONS: cs_error_t = 27; +pub const CS_ERR_CONTEXT_NOT_FOUND: cs_error_t = 28; +pub const CS_ERR_TOO_MANY_GROUPS: cs_error_t = 30; +pub const CS_ERR_SECURITY: cs_error_t = 100; +pub type cs_error_t = ::std::os::raw::c_uint; +extern "C" { + pub fn qb_to_cs_error(result: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cs_strerror(err: cs_error_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn hdb_error_to_cs(res: ::std::os::raw::c_int) -> cs_error_t; +} +pub type cpg_handle_t = u64; +pub type cpg_iteration_handle_t = u64; +pub const CPG_TYPE_UNORDERED: cpg_guarantee_t = 0; +pub const CPG_TYPE_FIFO: cpg_guarantee_t = 1; +pub const CPG_TYPE_AGREED: cpg_guarantee_t = 2; +pub const CPG_TYPE_SAFE: cpg_guarantee_t = 3; +pub type cpg_guarantee_t = ::std::os::raw::c_uint; +pub const CPG_FLOW_CONTROL_DISABLED: cpg_flow_control_state_t = 0; +pub const CPG_FLOW_CONTROL_ENABLED: cpg_flow_control_state_t = 1; +pub type cpg_flow_control_state_t = ::std::os::raw::c_uint; +pub const CPG_REASON_UNDEFINED: cpg_reason_t = 0; +pub const CPG_REASON_JOIN: cpg_reason_t = 1; +pub const CPG_REASON_LEAVE: cpg_reason_t = 2; +pub const CPG_REASON_NODEDOWN: cpg_reason_t = 3; +pub const CPG_REASON_NODEUP: cpg_reason_t = 4; +pub const CPG_REASON_PROCDOWN: cpg_reason_t = 5; +pub type cpg_reason_t = ::std::os::raw::c_uint; +pub const CPG_ITERATION_NAME_ONLY: cpg_iteration_type_t = 1; +pub const CPG_ITERATION_ONE_GROUP: cpg_iteration_type_t = 2; +pub const CPG_ITERATION_ALL: cpg_iteration_type_t = 3; +pub type cpg_iteration_type_t = ::std::os::raw::c_uint; +pub const CPG_MODEL_V1: cpg_model_t = 1; +pub type cpg_model_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpg_address { + pub nodeid: u32, + pub pid: u32, + pub reason: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cpg_name { + pub length: u32, + pub value: [::std::os::raw::c_char; 128usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cpg_iteration_description_t { + pub group: cpg_name, + pub nodeid: u32, + pub pid: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpg_ring_id { + pub nodeid: u32, + pub seq: u64, +} +pub type cpg_deliver_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: cpg_handle_t, + group_name: *const cpg_name, + nodeid: u32, + pid: u32, + msg: *mut ::std::os::raw::c_void, + msg_len: usize, + ), +>; +pub type cpg_confchg_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: cpg_handle_t, + group_name: *const cpg_name, + member_list: *const cpg_address, + member_list_entries: usize, + left_list: *const cpg_address, + left_list_entries: usize, + joined_list: *const cpg_address, + joined_list_entries: usize, + ), +>; +pub type cpg_totem_confchg_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: cpg_handle_t, + ring_id: cpg_ring_id, + member_list_entries: u32, + member_list: *const u32, + ), +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpg_callbacks_t { + pub cpg_deliver_fn: cpg_deliver_fn_t, + pub cpg_confchg_fn: cpg_confchg_fn_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpg_model_data_t { + pub model: cpg_model_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cpg_model_v1_data_t { + pub model: cpg_model_t, + pub cpg_deliver_fn: cpg_deliver_fn_t, + pub cpg_confchg_fn: cpg_confchg_fn_t, + pub cpg_totem_confchg_fn: cpg_totem_confchg_fn_t, + pub flags: ::std::os::raw::c_uint, +} +extern "C" { + pub fn cpg_initialize(handle: *mut cpg_handle_t, callbacks: *mut cpg_callbacks_t) + -> cs_error_t; +} +extern "C" { + pub fn cpg_model_initialize( + handle: *mut cpg_handle_t, + model: cpg_model_t, + model_data: *mut cpg_model_data_t, + context: *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_finalize(handle: cpg_handle_t) -> cs_error_t; +} +extern "C" { + pub fn cpg_fd_get(handle: cpg_handle_t, fd: *mut ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cpg_max_atomic_msgsize_get(handle: cpg_handle_t, size: *mut u32) -> cs_error_t; +} +extern "C" { + pub fn cpg_context_get( + handle: cpg_handle_t, + context: *mut *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_context_set( + handle: cpg_handle_t, + context: *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_dispatch(handle: cpg_handle_t, dispatch_types: cs_dispatch_flags_t) -> cs_error_t; +} +extern "C" { + pub fn cpg_join(handle: cpg_handle_t, group: *const cpg_name) -> cs_error_t; +} +extern "C" { + pub fn cpg_leave(handle: cpg_handle_t, group: *const cpg_name) -> cs_error_t; +} +extern "C" { + pub fn cpg_mcast_joined( + handle: cpg_handle_t, + guarantee: cpg_guarantee_t, + iovec: *const iovec, + iov_len: ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_membership_get( + handle: cpg_handle_t, + groupName: *mut cpg_name, + member_list: *mut cpg_address, + member_list_entries: *mut ::std::os::raw::c_int, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_local_get( + handle: cpg_handle_t, + local_nodeid: *mut ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_flow_control_state_get( + handle: cpg_handle_t, + flow_control_enabled: *mut cpg_flow_control_state_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_zcb_alloc( + handle: cpg_handle_t, + size: usize, + buffer: *mut *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_zcb_free(handle: cpg_handle_t, buffer: *mut ::std::os::raw::c_void) -> cs_error_t; +} +extern "C" { + pub fn cpg_zcb_mcast_joined( + handle: cpg_handle_t, + guarantee: cpg_guarantee_t, + msg: *mut ::std::os::raw::c_void, + msg_len: usize, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_iteration_initialize( + handle: cpg_handle_t, + iteration_type: cpg_iteration_type_t, + group: *const cpg_name, + cpg_iteration_handle: *mut cpg_iteration_handle_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_iteration_next( + handle: cpg_iteration_handle_t, + description: *mut cpg_iteration_description_t, + ) -> cs_error_t; +} +extern "C" { + pub fn cpg_iteration_finalize(handle: cpg_iteration_handle_t) -> cs_error_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/mod.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/mod.rs new file mode 100644 index 00000000..340dc62f --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/mod.rs @@ -0,0 +1,8 @@ +#![allow(non_camel_case_types, non_snake_case, dead_code, improper_ctypes)] + +pub mod cpg; +pub mod cfg; +pub mod cmap; +pub mod quorum; +pub mod votequorum; + diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/quorum.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/quorum.rs new file mode 100644 index 00000000..ffa62c91 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/quorum.rs @@ -0,0 +1,537 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +extern "C" { + pub fn __errno_location() -> *mut ::std::os::raw::c_int; +} +pub type clock_t = __clock_t; +pub type time_t = __time_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +pub type clockid_t = __clockid_t; +pub type timer_t = __timer_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +pub type pid_t = __pid_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +pub type suseconds_t = __suseconds_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +pub type sigset_t = __sigset_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +extern "C" { + pub fn gettimeofday( + __tv: *mut timeval, + __tz: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn settimeofday(__tv: *const timeval, __tz: *const timezone) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn adjtime(__delta: *const timeval, __olddelta: *mut timeval) -> ::std::os::raw::c_int; +} +pub const ITIMER_REAL: __itimer_which = 0; +pub const ITIMER_VIRTUAL: __itimer_which = 1; +pub const ITIMER_PROF: __itimer_which = 2; +pub type __itimer_which = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, +} +pub type __itimer_which_t = ::std::os::raw::c_int; +extern "C" { + pub fn getitimer(__which: __itimer_which_t, __value: *mut itimerval) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setitimer( + __which: __itimer_which_t, + __new: *const itimerval, + __old: *mut itimerval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn utimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lutimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn futimes(__fd: ::std::os::raw::c_int, __tvp: *const timeval) -> ::std::os::raw::c_int; +} +pub type cs_time_t = i64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cs_name_t { + pub length: u16, + pub value: [u8; 256usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cs_version_t { + pub releaseCode: ::std::os::raw::c_char, + pub majorVersion: ::std::os::raw::c_uchar, + pub minorVersion: ::std::os::raw::c_uchar, +} +pub const CS_DISPATCH_ONE: cs_dispatch_flags_t = 1; +pub const CS_DISPATCH_ALL: cs_dispatch_flags_t = 2; +pub const CS_DISPATCH_BLOCKING: cs_dispatch_flags_t = 3; +pub const CS_DISPATCH_ONE_NONBLOCKING: cs_dispatch_flags_t = 4; +pub type cs_dispatch_flags_t = ::std::os::raw::c_uint; +pub const CS_OK: cs_error_t = 1; +pub const CS_ERR_LIBRARY: cs_error_t = 2; +pub const CS_ERR_VERSION: cs_error_t = 3; +pub const CS_ERR_INIT: cs_error_t = 4; +pub const CS_ERR_TIMEOUT: cs_error_t = 5; +pub const CS_ERR_TRY_AGAIN: cs_error_t = 6; +pub const CS_ERR_INVALID_PARAM: cs_error_t = 7; +pub const CS_ERR_NO_MEMORY: cs_error_t = 8; +pub const CS_ERR_BAD_HANDLE: cs_error_t = 9; +pub const CS_ERR_BUSY: cs_error_t = 10; +pub const CS_ERR_ACCESS: cs_error_t = 11; +pub const CS_ERR_NOT_EXIST: cs_error_t = 12; +pub const CS_ERR_NAME_TOO_LONG: cs_error_t = 13; +pub const CS_ERR_EXIST: cs_error_t = 14; +pub const CS_ERR_NO_SPACE: cs_error_t = 15; +pub const CS_ERR_INTERRUPT: cs_error_t = 16; +pub const CS_ERR_NAME_NOT_FOUND: cs_error_t = 17; +pub const CS_ERR_NO_RESOURCES: cs_error_t = 18; +pub const CS_ERR_NOT_SUPPORTED: cs_error_t = 19; +pub const CS_ERR_BAD_OPERATION: cs_error_t = 20; +pub const CS_ERR_FAILED_OPERATION: cs_error_t = 21; +pub const CS_ERR_MESSAGE_ERROR: cs_error_t = 22; +pub const CS_ERR_QUEUE_FULL: cs_error_t = 23; +pub const CS_ERR_QUEUE_NOT_AVAILABLE: cs_error_t = 24; +pub const CS_ERR_BAD_FLAGS: cs_error_t = 25; +pub const CS_ERR_TOO_BIG: cs_error_t = 26; +pub const CS_ERR_NO_SECTIONS: cs_error_t = 27; +pub const CS_ERR_CONTEXT_NOT_FOUND: cs_error_t = 28; +pub const CS_ERR_TOO_MANY_GROUPS: cs_error_t = 30; +pub const CS_ERR_SECURITY: cs_error_t = 100; +pub type cs_error_t = ::std::os::raw::c_uint; +extern "C" { + pub fn qb_to_cs_error(result: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cs_strerror(err: cs_error_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn hdb_error_to_cs(res: ::std::os::raw::c_int) -> cs_error_t; +} +pub const QUORUM_MODEL_V0: quorum_model_t = 0; +pub const QUORUM_MODEL_V1: quorum_model_t = 1; +pub type quorum_model_t = ::std::os::raw::c_uint; +pub type quorum_handle_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct quorum_ring_id { + pub nodeid: u32, + pub seq: u64, +} +pub type quorum_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: quorum_handle_t, + quorate: u32, + ring_seq: u64, + view_list_entries: u32, + view_list: *mut u32, + ), +>; +pub type quorum_v1_quorum_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: quorum_handle_t, + quorate: u32, + ring_id: quorum_ring_id, + member_list_entries: u32, + member_list: *const u32, + ), +>; +pub type quorum_v1_nodelist_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: quorum_handle_t, + ring_id: quorum_ring_id, + member_list_entries: u32, + member_list: *const u32, + joined_list_entries: u32, + joined_list: *const u32, + left_list_entries: u32, + left_list: *const u32, + ), +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct quorum_callbacks_t { + pub quorum_notify_fn: quorum_notification_fn_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct quorum_model_data_t { + pub model: quorum_model_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct quorum_model_v0_data_t { + pub model: quorum_model_t, + pub quorum_notify_fn: quorum_notification_fn_t, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct quorum_model_v1_data_t { + pub model: quorum_model_t, + pub quorum_notify_fn: quorum_v1_quorum_notification_fn_t, + pub nodelist_notify_fn: quorum_v1_nodelist_notification_fn_t, +} +extern "C" { + pub fn quorum_initialize( + handle: *mut quorum_handle_t, + callbacks: *mut quorum_callbacks_t, + quorum_type: *mut u32, + ) -> cs_error_t; +} +extern "C" { + pub fn quorum_model_initialize( + handle: *mut quorum_handle_t, + model: quorum_model_t, + model_data: *mut quorum_model_data_t, + quorum_type: *mut u32, + context: *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn quorum_finalize(handle: quorum_handle_t) -> cs_error_t; +} +extern "C" { + pub fn quorum_fd_get(handle: quorum_handle_t, fd: *mut ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn quorum_dispatch( + handle: quorum_handle_t, + dispatch_types: cs_dispatch_flags_t, + ) -> cs_error_t; +} +extern "C" { + pub fn quorum_getquorate( + handle: quorum_handle_t, + quorate: *mut ::std::os::raw::c_int, + ) -> cs_error_t; +} +extern "C" { + pub fn quorum_trackstart(handle: quorum_handle_t, flags: ::std::os::raw::c_uint) -> cs_error_t; +} +extern "C" { + pub fn quorum_trackstop(handle: quorum_handle_t) -> cs_error_t; +} +extern "C" { + pub fn quorum_context_set( + handle: quorum_handle_t, + context: *const ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn quorum_context_get( + handle: quorum_handle_t, + context: *mut *const ::std::os::raw::c_void, + ) -> cs_error_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/sys/votequorum.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/votequorum.rs new file mode 100644 index 00000000..10fac545 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/sys/votequorum.rs @@ -0,0 +1,574 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +pub type int_least8_t = __int_least8_t; +pub type int_least16_t = __int_least16_t; +pub type int_least32_t = __int_least32_t; +pub type int_least64_t = __int_least64_t; +pub type uint_least8_t = __uint_least8_t; +pub type uint_least16_t = __uint_least16_t; +pub type uint_least32_t = __uint_least32_t; +pub type uint_least64_t = __uint_least64_t; +pub type int_fast8_t = ::std::os::raw::c_schar; +pub type int_fast16_t = ::std::os::raw::c_long; +pub type int_fast32_t = ::std::os::raw::c_long; +pub type int_fast64_t = ::std::os::raw::c_long; +pub type uint_fast8_t = ::std::os::raw::c_uchar; +pub type uint_fast16_t = ::std::os::raw::c_ulong; +pub type uint_fast32_t = ::std::os::raw::c_ulong; +pub type uint_fast64_t = ::std::os::raw::c_ulong; +pub type intmax_t = __intmax_t; +pub type uintmax_t = __uintmax_t; +extern "C" { + pub fn __errno_location() -> *mut ::std::os::raw::c_int; +} +pub type clock_t = __clock_t; +pub type time_t = __time_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +pub type clockid_t = __clockid_t; +pub type timer_t = __timer_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +pub type pid_t = __pid_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +pub type suseconds_t = __suseconds_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +pub type sigset_t = __sigset_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timezone { + pub tz_minuteswest: ::std::os::raw::c_int, + pub tz_dsttime: ::std::os::raw::c_int, +} +extern "C" { + pub fn gettimeofday( + __tv: *mut timeval, + __tz: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn settimeofday(__tv: *const timeval, __tz: *const timezone) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn adjtime(__delta: *const timeval, __olddelta: *mut timeval) -> ::std::os::raw::c_int; +} +pub const ITIMER_REAL: __itimer_which = 0; +pub const ITIMER_VIRTUAL: __itimer_which = 1; +pub const ITIMER_PROF: __itimer_which = 2; +pub type __itimer_which = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerval { + pub it_interval: timeval, + pub it_value: timeval, +} +pub type __itimer_which_t = ::std::os::raw::c_int; +extern "C" { + pub fn getitimer(__which: __itimer_which_t, __value: *mut itimerval) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setitimer( + __which: __itimer_which_t, + __new: *const itimerval, + __old: *mut itimerval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn utimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lutimes( + __file: *const ::std::os::raw::c_char, + __tvp: *const timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn futimes(__fd: ::std::os::raw::c_int, __tvp: *const timeval) -> ::std::os::raw::c_int; +} +pub type cs_time_t = i64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cs_name_t { + pub length: u16, + pub value: [u8; 256usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cs_version_t { + pub releaseCode: ::std::os::raw::c_char, + pub majorVersion: ::std::os::raw::c_uchar, + pub minorVersion: ::std::os::raw::c_uchar, +} +pub const CS_DISPATCH_ONE: cs_dispatch_flags_t = 1; +pub const CS_DISPATCH_ALL: cs_dispatch_flags_t = 2; +pub const CS_DISPATCH_BLOCKING: cs_dispatch_flags_t = 3; +pub const CS_DISPATCH_ONE_NONBLOCKING: cs_dispatch_flags_t = 4; +pub type cs_dispatch_flags_t = ::std::os::raw::c_uint; +pub const CS_OK: cs_error_t = 1; +pub const CS_ERR_LIBRARY: cs_error_t = 2; +pub const CS_ERR_VERSION: cs_error_t = 3; +pub const CS_ERR_INIT: cs_error_t = 4; +pub const CS_ERR_TIMEOUT: cs_error_t = 5; +pub const CS_ERR_TRY_AGAIN: cs_error_t = 6; +pub const CS_ERR_INVALID_PARAM: cs_error_t = 7; +pub const CS_ERR_NO_MEMORY: cs_error_t = 8; +pub const CS_ERR_BAD_HANDLE: cs_error_t = 9; +pub const CS_ERR_BUSY: cs_error_t = 10; +pub const CS_ERR_ACCESS: cs_error_t = 11; +pub const CS_ERR_NOT_EXIST: cs_error_t = 12; +pub const CS_ERR_NAME_TOO_LONG: cs_error_t = 13; +pub const CS_ERR_EXIST: cs_error_t = 14; +pub const CS_ERR_NO_SPACE: cs_error_t = 15; +pub const CS_ERR_INTERRUPT: cs_error_t = 16; +pub const CS_ERR_NAME_NOT_FOUND: cs_error_t = 17; +pub const CS_ERR_NO_RESOURCES: cs_error_t = 18; +pub const CS_ERR_NOT_SUPPORTED: cs_error_t = 19; +pub const CS_ERR_BAD_OPERATION: cs_error_t = 20; +pub const CS_ERR_FAILED_OPERATION: cs_error_t = 21; +pub const CS_ERR_MESSAGE_ERROR: cs_error_t = 22; +pub const CS_ERR_QUEUE_FULL: cs_error_t = 23; +pub const CS_ERR_QUEUE_NOT_AVAILABLE: cs_error_t = 24; +pub const CS_ERR_BAD_FLAGS: cs_error_t = 25; +pub const CS_ERR_TOO_BIG: cs_error_t = 26; +pub const CS_ERR_NO_SECTIONS: cs_error_t = 27; +pub const CS_ERR_CONTEXT_NOT_FOUND: cs_error_t = 28; +pub const CS_ERR_TOO_MANY_GROUPS: cs_error_t = 30; +pub const CS_ERR_SECURITY: cs_error_t = 100; +pub type cs_error_t = ::std::os::raw::c_uint; +extern "C" { + pub fn qb_to_cs_error(result: ::std::os::raw::c_int) -> cs_error_t; +} +extern "C" { + pub fn cs_strerror(err: cs_error_t) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn hdb_error_to_cs(res: ::std::os::raw::c_int) -> cs_error_t; +} +pub type votequorum_handle_t = u64; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct votequorum_info { + pub node_id: ::std::os::raw::c_uint, + pub node_state: ::std::os::raw::c_uint, + pub node_votes: ::std::os::raw::c_uint, + pub node_expected_votes: ::std::os::raw::c_uint, + pub highest_expected: ::std::os::raw::c_uint, + pub total_votes: ::std::os::raw::c_uint, + pub quorum: ::std::os::raw::c_uint, + pub flags: ::std::os::raw::c_uint, + pub qdevice_votes: ::std::os::raw::c_uint, + pub qdevice_name: [::std::os::raw::c_char; 255usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct votequorum_node_t { + pub nodeid: u32, + pub state: u32, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct votequorum_ring_id_t { + pub nodeid: u32, + pub seq: u64, +} +pub type votequorum_quorum_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: votequorum_handle_t, + context: u64, + quorate: u32, + node_list_entries: u32, + node_list: *mut votequorum_node_t, + ), +>; +pub type votequorum_nodelist_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn( + handle: votequorum_handle_t, + context: u64, + ring_id: votequorum_ring_id_t, + node_list_entries: u32, + node_list: *mut u32, + ), +>; +pub type votequorum_expectedvotes_notification_fn_t = ::std::option::Option< + unsafe extern "C" fn(handle: votequorum_handle_t, context: u64, expected_votes: u32), +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct votequorum_callbacks_t { + pub votequorum_quorum_notify_fn: votequorum_quorum_notification_fn_t, + pub votequorum_expectedvotes_notify_fn: votequorum_expectedvotes_notification_fn_t, + pub votequorum_nodelist_notify_fn: votequorum_nodelist_notification_fn_t, +} +extern "C" { + pub fn votequorum_initialize( + handle: *mut votequorum_handle_t, + callbacks: *mut votequorum_callbacks_t, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_finalize(handle: votequorum_handle_t) -> cs_error_t; +} +extern "C" { + pub fn votequorum_dispatch( + handle: votequorum_handle_t, + dispatch_types: cs_dispatch_flags_t, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_fd_get( + handle: votequorum_handle_t, + fd: *mut ::std::os::raw::c_int, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_getinfo( + handle: votequorum_handle_t, + nodeid: ::std::os::raw::c_uint, + info: *mut votequorum_info, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_setexpected( + handle: votequorum_handle_t, + expected_votes: ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_setvotes( + handle: votequorum_handle_t, + nodeid: ::std::os::raw::c_uint, + votes: ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_trackstart( + handle: votequorum_handle_t, + context: u64, + flags: ::std::os::raw::c_uint, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_trackstop(handle: votequorum_handle_t) -> cs_error_t; +} +extern "C" { + pub fn votequorum_context_get( + handle: votequorum_handle_t, + context: *mut *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_context_set( + handle: votequorum_handle_t, + context: *mut ::std::os::raw::c_void, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_qdevice_register( + handle: votequorum_handle_t, + name: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_qdevice_unregister( + handle: votequorum_handle_t, + name: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_qdevice_update( + handle: votequorum_handle_t, + oldname: *const ::std::os::raw::c_char, + newname: *const ::std::os::raw::c_char, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_qdevice_poll( + handle: votequorum_handle_t, + name: *const ::std::os::raw::c_char, + cast_vote: ::std::os::raw::c_uint, + ring_id: votequorum_ring_id_t, + ) -> cs_error_t; +} +extern "C" { + pub fn votequorum_qdevice_master_wins( + handle: votequorum_handle_t, + name: *const ::std::os::raw::c_char, + allow: ::std::os::raw::c_uint, + ) -> cs_error_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} diff --git a/src/pmxcfs-rs/vendor/rust-corosync/src/votequorum.rs b/src/pmxcfs-rs/vendor/rust-corosync/src/votequorum.rs new file mode 100644 index 00000000..0eb76541 --- /dev/null +++ b/src/pmxcfs-rs/vendor/rust-corosync/src/votequorum.rs @@ -0,0 +1,556 @@ +// libvotequorum interface for Rust +// Copyright (c) 2021 Red Hat, Inc. +// +// All rights reserved. +// +// Author: Christine Caulfield (ccaulfi@redhat.com) +// + + +// For the code generated by bindgen +use crate::sys::votequorum as ffi; + +use std::os::raw::{c_void, c_int}; +use std::slice; +use std::collections::HashMap; +use std::sync::Mutex; +use std::ffi::CString; +use std::fmt; + +use crate::{CsError, DispatchFlags, TrackFlags, Result, NodeId}; +use crate::string_from_bytes; + + +/// RingId returned by votequorum_notification_fn +pub struct RingId { + pub nodeid: NodeId, + pub seq: u64, +} + +// Used to convert a VOTEQUORUM handle into one of ours +lazy_static! { + static ref HANDLE_HASH: Mutex> = Mutex::new(HashMap::new()); +} + +/// Current state of a node in the cluster, part of the [NodeInfo] and [Node] structs +pub enum NodeState +{ + Member, + Dead, + Leaving, + Unknown, +} +impl NodeState { + pub fn new(state: u32) -> NodeState + { + match state { + 1 => NodeState::Member, + 2 => NodeState::Dead, + 3 => NodeState::Leaving, + _ => NodeState::Unknown, + } + } +} +impl fmt::Debug for NodeState { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + NodeState::Member => write!(f, "Member"), + NodeState::Dead => write!(f, "Dead"), + NodeState::Leaving => write!(f, "Leaving"), + _ => write!(f, "Unknown"), + } + } +} + +/// Basic information about a node in the cluster. Contains [NodeId], and [NodeState] +pub struct Node +{ + nodeid: NodeId, + state: NodeState +} +impl fmt::Debug for Node { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "nodeid: {}, state: {:?}", self.nodeid, self.state) + } +} + +bitflags! { +/// Flags in the [NodeInfo] struct + pub struct NodeInfoFlags: u32 + { + const VOTEQUORUM_INFO_TWONODE = 1; + const VOTEQUORUM_INFO_QUORATE = 2; + const VOTEQUORUM_INFO_WAIT_FOR_ALL = 4; + const VOTEQUORUM_INFO_LAST_MAN_STANDING = 8; + const VOTEQUORUM_INFO_AUTO_TIE_BREAKER = 16; + const VOTEQUORUM_INFO_ALLOW_DOWNSCALE = 32; + const VOTEQUORUM_INFO_QDEVICE_REGISTERED = 64; + const VOTEQUORUM_INFO_QDEVICE_ALIVE = 128; + const VOTEQUORUM_INFO_QDEVICE_CAST_VOTE = 256; + const VOTEQUORUM_INFO_QDEVICE_MASTER_WINS = 512; + } +} + +/// Detailed information about a node in the cluster, returned from [get_info] +pub struct NodeInfo +{ + pub node_id: NodeId, + pub node_state: NodeState, + pub node_votes: u32, + pub node_expected_votes: u32, + pub highest_expected: u32, + pub quorum: u32, + pub flags: NodeInfoFlags, + pub qdevice_votes: u32, + pub qdevice_name: String, +} + +// Turn a C nodeID list into a vec of NodeIds +fn list_to_vec(list_entries: u32, list: *const u32) -> Vec +{ + let mut r_member_list = Vec::::new(); + let temp_members: &[u32] = unsafe { slice::from_raw_parts(list, list_entries as usize) }; + for i in 0..list_entries as usize { + r_member_list.push(NodeId::from(temp_members[i])); + } + r_member_list +} + +// Called from votequorum callback function - munge params back to Rust from C +extern "C" fn rust_expectedvotes_notification_fn( + handle: ffi::votequorum_handle_t, + context: u64, + expected_votes: u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + match h.callbacks.expectedvotes_notification_fn { + Some(cb) => (cb)(h, + context, + expected_votes), + None => {} + } + } + None => {} + } +} + +// Called from votequorum callback function - munge params back to Rust from C +extern "C" fn rust_quorum_notification_fn( + handle: ffi::votequorum_handle_t, + context: u64, + quorate: u32, + node_list_entries: u32, + node_list: *mut ffi::votequorum_node_t) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_quorate = match quorate { + 0 => false, + 1 => true, + _ => false, + }; + let mut r_node_list = Vec::::new(); + let temp_members: &[ffi::votequorum_node_t] = + unsafe { slice::from_raw_parts(node_list, node_list_entries as usize) }; + for i in 0..node_list_entries as usize { + r_node_list.push(Node{nodeid: NodeId::from(temp_members[i].nodeid), + state: NodeState::new(temp_members[i].state)} ); + } + match h.callbacks.quorum_notification_fn { + Some (cb) => (cb)(h, + context, + r_quorate, + r_node_list), + None => {} + } + } + None => {} + } +} + +// Called from votequorum callback function - munge params back to Rust from C +extern "C" fn rust_nodelist_notification_fn( + handle: ffi::votequorum_handle_t, + context: u64, + ring_id: ffi::votequorum_ring_id_t, + node_list_entries: u32, + node_list: *mut u32) +{ + match HANDLE_HASH.lock().unwrap().get(&handle) { + Some(h) => { + let r_ring_id = RingId{nodeid: NodeId::from(ring_id.nodeid), + seq: ring_id.seq}; + + let r_node_list = list_to_vec(node_list_entries, node_list); + + match h.callbacks.nodelist_notification_fn { + Some (cb) => + (cb)(h, + context, + r_ring_id, + r_node_list), + None => {} + } + } + None => {} + } +} + +/// Callbacks that can be called from votequorum, pass these in to [initialize] +#[derive(Copy, Clone)] +pub struct Callbacks { + pub quorum_notification_fn: Option)>, + pub nodelist_notification_fn: Option)>, + pub expectedvotes_notification_fn: Option, +} + +/// A handle into the votequorum library. Returned from [initialize] and needed for all other calls +#[derive(Copy, Clone)] +pub struct Handle { + votequorum_handle: u64, + callbacks: Callbacks +} + +/// Initialize a connection to the votequorum library. You must call this before doing anything +/// else and use the passed back [Handle]. +/// Remember to free the handle using [finalize] when finished. +pub fn initialize(callbacks: &Callbacks) -> Result +{ + let mut handle: ffi::votequorum_handle_t = 0; + + let mut c_callbacks = ffi::votequorum_callbacks_t { + votequorum_quorum_notify_fn: Some(rust_quorum_notification_fn), + votequorum_nodelist_notify_fn: Some(rust_nodelist_notification_fn), + votequorum_expectedvotes_notify_fn: Some(rust_expectedvotes_notification_fn), + }; + + unsafe { + let res = ffi::votequorum_initialize(&mut handle, + &mut c_callbacks); + if res == ffi::CS_OK { + let rhandle = Handle{votequorum_handle: handle, callbacks: callbacks.clone()}; + HANDLE_HASH.lock().unwrap().insert(handle, rhandle); + Ok(rhandle) + } else { + Err(CsError::from_c(res)) + } + } +} + + +/// Finish with a connection to corosync +pub fn finalize(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_finalize(handle.votequorum_handle) + }; + if res == ffi::CS_OK { + HANDLE_HASH.lock().unwrap().remove(&handle.votequorum_handle); + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +// Not sure if an FD is the right thing to return here, but it will do for now. +/// Return a file descriptor to use for poll/select on the VOTEQUORUM handle +pub fn fd_get(handle: Handle) -> Result +{ + let c_fd: *mut c_int = &mut 0 as *mut _ as *mut c_int; + let res = + unsafe { + ffi::votequorum_fd_get(handle.votequorum_handle, c_fd) + }; + if res == ffi::CS_OK { + Ok(unsafe { *c_fd }) + } else { + Err(CsError::from_c(res)) + } +} + + +const VOTEQUORUM_QDEVICE_MAX_NAME_LEN : usize = 255; + +/// Returns detailed information about a node in a [NodeInfo] structure +pub fn get_info(handle: Handle, nodeid: NodeId) -> Result +{ + let mut c_info = ffi::votequorum_info { + node_id: 0, + node_state:0, + node_votes: 0, + node_expected_votes:0, + highest_expected:0, + total_votes:0, + quorum:0, + flags:0, + qdevice_votes:0, + qdevice_name: [0; 255usize] + }; + let res = + unsafe { + ffi::votequorum_getinfo(handle.votequorum_handle, u32::from(nodeid), &mut c_info) + }; + + if res == ffi::CS_OK { + let info = NodeInfo { + node_id : NodeId::from(c_info.node_id), + node_state : NodeState::new(c_info.node_state), + node_votes : c_info.node_votes, + node_expected_votes : c_info.node_expected_votes, + highest_expected : c_info.highest_expected, + quorum : c_info.quorum, + flags : NodeInfoFlags{bits: c_info.flags}, + qdevice_votes : c_info.qdevice_votes, + qdevice_name : match string_from_bytes(c_info.qdevice_name.as_ptr(), VOTEQUORUM_QDEVICE_MAX_NAME_LEN) { + Ok(s) => s, + Err(_) => String::new() + }, + }; + Ok(info) + } else { + Err(CsError::from_c(res)) + } +} + +/// Call any/all active votequorum callbacks for this [Handle]. see [DispatchFlags] for details +pub fn dispatch(handle: Handle, flags: DispatchFlags) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_dispatch(handle.votequorum_handle, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Track node and votequorum changes +pub fn trackstart(handle: Handle, context: u64, flags: TrackFlags) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_trackstart(handle.votequorum_handle, context, flags as u32) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Stop tracking node and votequorum changes +pub fn trackstop(handle: Handle) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_trackstop(handle.votequorum_handle) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Get the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source +pub fn context_get(handle: Handle) -> Result +{ + let (res, context) = + unsafe { + let mut c_context: *mut c_void = &mut 0u64 as *mut _ as *mut c_void; + let r = ffi::votequorum_context_get(handle.votequorum_handle, &mut c_context); + let context: u64 = c_context as u64; + (r, context) + }; + if res == ffi::CS_OK { + Ok(context) + } else { + Err(CsError::from_c(res)) + } +} + +/// Set the current 'context' value for this handle. +/// The context value is an arbitrary value that is always passed +/// back to callbacks to help identify the source. +/// Normally this is set in [trackstart], but this allows it to be changed +pub fn context_set(handle: Handle, context: u64) -> Result<()> +{ + let res = + unsafe { + let c_context = context as *mut c_void; + ffi::votequorum_context_set(handle.votequorum_handle, c_context) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Set the current expected_votes for the cluster, this value must +/// be valid and not result in an inquorate cluster. +pub fn set_expected(handle: Handle, expected_votes: u32) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_setexpected(handle.votequorum_handle, expected_votes) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Set the current votes for a node +pub fn set_votes(handle: Handle, nodeid: NodeId, votes: u32) -> Result<()> +{ + let res = + unsafe { + ffi::votequorum_setvotes(handle.votequorum_handle, u32::from(nodeid), votes) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Register a quorum device +pub fn qdevice_register(handle: Handle, name: &String) -> Result<()> +{ + let c_string = { + match CString::new(name.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let res = + unsafe { + ffi::votequorum_qdevice_register(handle.votequorum_handle, c_string. as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Unregister a quorum device +pub fn qdevice_unregister(handle: Handle, name: &String) -> Result<()> +{ + let c_string = { + match CString::new(name.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let res = + unsafe { + ffi::votequorum_qdevice_unregister(handle.votequorum_handle, c_string. as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + +/// Update the name of a quorum device +pub fn qdevice_update(handle: Handle, oldname: &String, newname: &String) -> Result<()> +{ + let on_string = { + match CString::new(oldname.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + let nn_string = { + match CString::new(newname.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let res = + unsafe { + ffi::votequorum_qdevice_update(handle.votequorum_handle, on_string.as_ptr(), nn_string.as_ptr()) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Poll a quorum device +/// This must be done more often than the qdevice timeout (default 10s) while the device is active +/// and the [RingId] must match the current value returned from the callbacks for it to be accepted. +pub fn qdevice_poll(handle: Handle, name: &String, cast_vote: bool, ring_id: &RingId) -> Result<()> +{ + let c_string = { + match CString::new(name.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let c_cast_vote : u32 = if cast_vote {1} else {0}; + let c_ring_id = ffi::votequorum_ring_id_t { + nodeid: u32::from(ring_id.nodeid), + seq: ring_id.seq}; + + let res = + unsafe { + ffi::votequorum_qdevice_poll(handle.votequorum_handle, c_string.as_ptr(), c_cast_vote, c_ring_id) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} + + +/// Allow qdevice to tell votequorum if master_wins can be enabled or not +pub fn qdevice_master_wins(handle: Handle, name: &String, master_wins: bool) -> Result<()> +{ + let c_string = { + match CString::new(name.as_str()) { + Ok(cs) => cs, + Err(_) => return Err(CsError::CsErrInvalidParam), + } + }; + + let c_master_wins : u32 = if master_wins {1} else {0}; + + let res = + unsafe { + ffi::votequorum_qdevice_master_wins(handle.votequorum_handle, c_string.as_ptr(), c_master_wins) + }; + if res == ffi::CS_OK { + Ok(()) + } else { + Err(CsError::from_c(res)) + } +} -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel