diff options
Diffstat (limited to 'src/c_lang')
| -rw-r--r-- | src/c_lang/fs4.rs | 599 | ||||
| -rw-r--r-- | src/c_lang/fs4_binding.rs | 961 | ||||
| -rw-r--r-- | src/c_lang/mod.rs | 2 |
3 files changed, 1562 insertions, 0 deletions
diff --git a/src/c_lang/fs4.rs b/src/c_lang/fs4.rs new file mode 100644 index 0000000..6668ba7 --- /dev/null +++ b/src/c_lang/fs4.rs @@ -0,0 +1,599 @@ + +use std::ffi::{CString, CStr}; +use std::os::raw::{c_longlong, c_char}; +use std::fmt::Debug; +use std::marker::PhantomData; +use std::mem; +use libc; + +use super::fs4_binding; + + +pub struct Fieldstat { + content: *mut fs4_binding::fieldstat, +} + +#[derive(Clone, Debug)] +pub enum FieldstatTagType { + LongLong, + Double, + String, +} + +pub enum SampleMode { + Comprehensive, + TopK, +} + +pub enum CounterMergeMode { + BySum, + ByMax, + ByMin, +} + +pub enum MetricType { + Counter, + HLL, + Histogram, +} + +#[derive(Debug, Clone)] +pub enum FieldstatErr { + WrongCube, + WrongCell, + WrongMetric, + WrongCubeOrParameter, // todo: 现在C 上不做区别,抽空调一下 + // todo: anyhow 替代result + // todo: 删fs4_binding 里的东西 + // todo: 改名字就叫fieldstat + WrongParameter, + CubeIsFull, + DuplicateKey, +} + +impl FieldstatTagType { + fn as_c_corresponding_type(&self) -> fs4_binding::fs_tag_type { + match self { + FieldstatTagType::LongLong => 0 as fs4_binding::fs_tag_type, + FieldstatTagType::Double => 1 as fs4_binding::fs_tag_type, + FieldstatTagType::String => 2 as fs4_binding::fs_tag_type, + } + } +} + +pub struct FieldstatTag<T: Taggable> { + content: fs4_binding::fieldstat_tag, + value_type: FieldstatTagType, + + phantom: PhantomData<T>, +} + +pub trait Taggable: Clone + Debug{ + type Output; + fn type_id(&self) -> FieldstatTagType; + fn into_c_corresponding(self) -> fs4_binding::fieldstat_tag__bindgen_ty_1; +} + +impl Taggable for i64 { + type Output = i64; + + fn type_id(&self) -> FieldstatTagType { + FieldstatTagType::LongLong + } + fn into_c_corresponding(self) -> fs4_binding::fieldstat_tag__bindgen_ty_1 { + fs4_binding::fieldstat_tag__bindgen_ty_1 { + value_longlong: self as c_longlong, + } + } +} + +impl Taggable for f64 { + type Output = f64; + + fn type_id(&self) -> FieldstatTagType { + FieldstatTagType::Double + } + fn into_c_corresponding(self) -> fs4_binding::fieldstat_tag__bindgen_ty_1 { + fs4_binding::fieldstat_tag__bindgen_ty_1 { + value_double: self as f64 + } + } +} + +impl Taggable for String { + type Output = String; + + fn type_id(&self) -> FieldstatTagType { + FieldstatTagType::String + } + fn into_c_corresponding(self) -> fs4_binding::fieldstat_tag__bindgen_ty_1 { + fs4_binding::fieldstat_tag__bindgen_ty_1 { + value_str: CString::new(self).unwrap().into_raw() as *mut c_char, + } + } +} + +impl<T: Taggable> FieldstatTag<T> { + fn new(name: &str, value: T) -> Self { + let c_string = CString::new(name).unwrap(); + let typeid = value.type_id(); + Self { + content: fs4_binding::fieldstat_tag { + key: c_string.into_raw(), + type_: value.type_id().as_c_corresponding_type(), + __bindgen_anon_1: value.into_c_corresponding(), + }, + value_type: typeid, + + phantom: PhantomData, + } + } + + fn value_type(&self) -> FieldstatTagType { + self.value_type.clone() + } + + fn key(&self) -> String { + unsafe { + let rust_str = CStr::from_ptr(self.content.key).to_owned(); + rust_str.to_str().unwrap().to_string() + } + } +} + +impl FieldstatTag<i64> +{ + fn value(&self) -> i64 { + unsafe { + self.content.__bindgen_anon_1.value_longlong + } + } +} + +impl FieldstatTag<f64> +{ + fn value(&self) -> f64 { + unsafe { + self.content.__bindgen_anon_1.value_double + } + } +} + +impl FieldstatTag<String> +{ + fn value(&self) -> String { + unsafe { + let rust_str = CStr::from_ptr(self.content.__bindgen_anon_1.value_str).to_owned(); + rust_str.to_str().unwrap().to_string() + } + } +} + + +pub enum FieldstatTagWrapper { + LongLong(FieldstatTag<i64>), + Double(FieldstatTag<f64>), + String(FieldstatTag<String>), +} + +impl Fieldstat { + pub fn new() -> Self { + Self { + content: unsafe { fs4_binding::fieldstat_new() }, + } + } + pub fn register_counter(&mut self, name: &str, cube_id: i64, mode: CounterMergeMode) -> Result<i32, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_register_counter( + self.content, + cube_id as std::os::raw::c_int, + CString::new(name).unwrap().into_raw(), + mode as fs4_binding::counter_mode, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + _ => Ok(ret), + } + } + } + pub fn register_hll(&mut self, name: &str, cube_id: i64, precision: u8) -> Result<i32, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_register_hll( + self.content, + cube_id as std::os::raw::c_int, + CString::new(name).unwrap().into_raw(), + precision as std::os::raw::c_uchar, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCubeOrParameter), + _ => Ok(ret), + } + } + } + pub fn register_histogram(&mut self, name: &str, cube_id: i64, + lowest_trackable_value: i64, highest_trackable_value: i64, significant_figures: i32) -> Result<i32, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_register_hist( + self.content, + cube_id as std::os::raw::c_int, + CString::new(name).unwrap().into_raw(), + lowest_trackable_value as std::os::raw::c_longlong, + highest_trackable_value as std::os::raw::c_longlong, + significant_figures as std::os::raw::c_int, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCubeOrParameter), + _ => Ok(ret), + } + } + } + pub fn new_with_same_config(&self) -> Self { + Self { + content: unsafe { fs4_binding::fieldstat_dup(self.content) }, + } + } + pub fn register_cube<T: Taggable>(&mut self, shared_tags: &[FieldstatTag<T>], mode: SampleMode, max_n_cell: usize) -> Result<i32, FieldstatErr> { + let c_mode = match mode { + SampleMode::Comprehensive => fs4_binding::sampling_mode_SAMPLING_MODE_COMPREHENSIVE, + SampleMode::TopK => fs4_binding::sampling_mode_SAMPLING_MODE_TOPK, + }; + let mut c_tag_structs = Vec::with_capacity(shared_tags.len()); + for tag in shared_tags { + c_tag_structs.push(tag.content); + } + + unsafe { + let ret = fs4_binding::fieldstat_register_cube( + self.content, + c_tag_structs.as_ptr(), + shared_tags.len(), + c_mode, + max_n_cell); + + match ret { + -1 => Err(FieldstatErr::WrongParameter), + -2 => Err(FieldstatErr::DuplicateKey), + _ => Ok(ret), + } + } + } + pub fn unregister_cube(&mut self, cube_id: i64) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_unregister_cube(self.content, cube_id as std::os::raw::c_int); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + _ => Ok(()), + } + } + } + pub fn get_cube_version(&self, cube_id: i64) -> Result<i64, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_get_cube_version(self.content, cube_id as std::os::raw::c_int); + + match ret { + -1 | -2 | -3 => Err(FieldstatErr::WrongCube), + _ => Ok(ret), + } + } + } + pub fn cube_add<T: Taggable>(&mut self, cube_id: i64, tags: &[FieldstatTag<T>], value: i64) -> Result<i32, FieldstatErr> { + let mut c_tag_structs = Vec::with_capacity(tags.len()); + for tag in tags { + c_tag_structs.push(tag.content); + } + + unsafe { + let ret = fs4_binding::fieldstat_cube_add( + self.content, + cube_id as std::os::raw::c_int, + c_tag_structs.as_ptr(), + tags.len(), + value as std::os::raw::c_longlong, + ); + + match ret { + -1 => Err(FieldstatErr::CubeIsFull), + -2 => Err(FieldstatErr::WrongCell), + _ => Ok(ret), + } + } + } + pub fn counter_incrby(&mut self, cube_id: i32, metric_id: i32, cell_id: i32, increment: i64) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_counter_incrby( + self.content, + cube_id as std::os::raw::c_int, + metric_id as std::os::raw::c_int, + cell_id as std::os::raw::c_int, + increment as std::os::raw::c_longlong, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + -2 => Err(FieldstatErr::WrongMetric), + -3 => Err(FieldstatErr::WrongCell), + -4 => Err(FieldstatErr::WrongParameter), + _ => Ok(()), + } + } + } + pub fn counter_set(&mut self, cube_id: i32, metric_id: i32, cell_id: i32, value: i64) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_counter_set( + self.content, + cube_id as std::os::raw::c_int, + metric_id as std::os::raw::c_int, + cell_id as std::os::raw::c_int, + value as std::os::raw::c_longlong, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + -2 => Err(FieldstatErr::WrongMetric), + -3 => Err(FieldstatErr::WrongCell), + -4 => Err(FieldstatErr::WrongParameter), + _ => Ok(()), + } + } + } + pub fn hll_add(&mut self, cube_id: i32, metric_id: i32, cell_id: i32, key: &str) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_hll_add( + self.content, + cube_id as std::os::raw::c_int, + metric_id as std::os::raw::c_int, + cell_id as std::os::raw::c_int, + CString::new(key).unwrap().into_raw(), + key.len(), + ); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + -2 => Err(FieldstatErr::WrongMetric), + -3 => Err(FieldstatErr::WrongCell), + -4 => Err(FieldstatErr::WrongParameter), + _ => Ok(()), + } + } + } + pub fn histogram_record(&mut self, cube_id: i32, metric_id: i32, cell_id: i32, value: i64) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_hist_record( + self.content, + cube_id as std::os::raw::c_int, + metric_id as std::os::raw::c_int, + cell_id as std::os::raw::c_int, + value as std::os::raw::c_longlong, + ); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + -2 => Err(FieldstatErr::WrongMetric), + -3 => Err(FieldstatErr::WrongCell), + -4 => Err(FieldstatErr::WrongParameter), + _ => Ok(()), + } + } + } + pub fn reset(&mut self) { + unsafe { + fs4_binding::fieldstat_reset(self.content); + } + } + pub fn get_cell_version(&self) -> u64 { + unsafe { + fs4_binding::fieldstat_get_cell_version(self.content) + } + } + pub fn merge(&mut self, other: &Fieldstat) -> Result<(), FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_merge(self.content, other.content); + + match ret { + -1 => Err(FieldstatErr::WrongParameter), + _ => Ok(()), + } + } + } + pub fn serialize(&self) -> Vec<u8> { + unsafe { + let mut blob_out: *mut ::std::os::raw::c_char = std::ptr::null_mut(); + let mut blob_size_out: usize = 0; + + fs4_binding::fieldstat_serialize(self.content, &mut blob_out, &mut blob_size_out); + let vec = Vec::from_raw_parts(blob_out as *mut u8, blob_size_out, blob_size_out); + + libc::free(blob_out as *mut libc::c_void); + vec + } + } + pub fn deserialize(&mut self, blob: &[u8]) -> Option<Self> { + unsafe { + let ret = fs4_binding::fieldstat_deserialize(blob.as_ptr() as *const ::std::os::raw::c_char, blob.len()); + + if ret == std::ptr::null_mut() { + None + } else { + Some(Self { + content: ret, + }) + } + } + } + + /* ---------------------------------- query --------------------------------- */ + pub fn get_cubes(&self) -> Vec<i32> { + unsafe { + let mut cubes: *mut i32 = std::ptr::null_mut(); + // int *cube = NULL; + let mut n_cubes: i32 = 0; + + fs4_binding::fieldstat_get_cubes(self.content, &mut cubes, &mut n_cubes); + let vec = Vec::from_raw_parts(cubes, n_cubes as usize, n_cubes as usize); + + libc::free(cubes as *mut libc::c_void); + vec + } + } + pub fn get_max_metric_id(&self, cube_id: i32) -> Result<i32, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_get_max_metric_id(self.content, cube_id as std::os::raw::c_int); + + match ret { + -1 => Err(FieldstatErr::WrongCube), + _ => Ok(ret), + } + } + } + pub fn get_metric_name(&self, cube_id: i32, metric_id: i32) -> Result<String, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_get_metric_name(self.content, cube_id as std::os::raw::c_int, metric_id as std::os::raw::c_int); + if ret == std::ptr::null_mut() { + Err(FieldstatErr::WrongMetric) + } else { + let rust_str = CStr::from_ptr(ret).to_owned(); + Ok(rust_str.to_str().unwrap().to_string()) + } + } + } + pub fn get_metric_type(&self, cube_id: i32, metric_id: i32) -> Result<MetricType, FieldstatErr> { + unsafe { + let ret = fs4_binding::fieldstat_get_metric_type(self.content, cube_id as std::os::raw::c_int, metric_id as std::os::raw::c_int); + + match ret { + fs4_binding::metric_type_METRIC_TYPE_COUNTER => Ok(MetricType::Counter), + fs4_binding::metric_type_METRIC_TYPE_HLL => Ok(MetricType::HLL), + fs4_binding::metric_type_METRIC_TYPE_HISTOGRAM => Ok(MetricType::Histogram), + _ => Err(FieldstatErr::WrongMetric), + } + } + } + pub fn cube_read_cell(&self, cube_id: i32) -> Option<Vec< (i32, Vec<FieldstatTagWrapper>)>> { + unsafe { + let mut cell_id: *mut std::os::raw::c_int = std::ptr::null_mut(); + let mut tags: *mut fs4_binding::fieldstat_tag_list = std::ptr::null_mut(); + let mut n_cell: usize = 0; + + fs4_binding::fieldstat_cube_read_cell(self.content, + cube_id as std::os::raw::c_int, + &mut cell_id, + &mut tags, + &mut n_cell); + + if n_cell == 0 { + return None; + } + + let mut ret = Vec::with_capacity(n_cell); + let tags_list_vec = Vec::from_raw_parts(tags, n_cell, n_cell); + let cell_id_vec = Vec::from_raw_parts(cell_id, n_cell, n_cell); + + for i in 0..n_cell { + let tag_vec = fieldstat_tag_list_to_vec(tags_list_vec.get_unchecked(i)); + ret.push((cell_id_vec[i], tag_vec)); + } + + libc::free(cell_id as *mut libc::c_void); + fs4_binding::fieldstat_tag_list_arr_free(tags, n_cell); + + Some(ret) + } + } + +} + +impl Drop for Fieldstat { + fn drop(&mut self) { + unsafe { + fs4_binding::fieldstat_free(self.content); + } + } +} + +fn fieldstat_tag_list_to_vec(tag_list_p: *const fs4_binding::fieldstat_tag_list) + -> Vec<FieldstatTagWrapper> { + unsafe { + let tag_p_vec = Vec::from_raw_parts((*tag_list_p).tag, (*tag_list_p).n_tag, (*tag_list_p).n_tag); + let mut ret = Vec::with_capacity(tag_p_vec.len()); + for item in tag_p_vec { + let value_type = match item.type_ { + fs4_binding::fs_tag_type_TAG_INTEGER => { + FieldstatTagType::LongLong + }, + fs4_binding::fs_tag_type_TAG_DOUBLE => { + FieldstatTagType::Double + }, + fs4_binding::fs_tag_type_TAG_CSTRING => { + FieldstatTagType::String + }, + _ => panic!("unknown tag type"), + }; + + ret.push(match value_type { + FieldstatTagType::LongLong => FieldstatTagWrapper::LongLong( + FieldstatTag { content: item, value_type: value_type, phantom: PhantomData }), + FieldstatTagType::Double => FieldstatTagWrapper::Double( + FieldstatTag { content: item, value_type: value_type, phantom: PhantomData }), + FieldstatTagType::String => FieldstatTagWrapper::String( + FieldstatTag { content: item, value_type: value_type, phantom: PhantomData }), + }); + } + ret + } +} + + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn new_tag_int() { + let tag = FieldstatTag::new("test", 1); + assert_eq!(tag.key(), "test"); + assert_eq!(tag.value(), 1); + } + + #[test] + fn new_tag_float() { + let tag = FieldstatTag::new("test", 1.0); + assert_eq!(tag.key(), "test"); + assert_eq!(tag.value(), 1.0); + } + + #[test] + fn new_tag_str() { + let tag = FieldstatTag::new("test", "hello1".to_string()); + assert_eq!(tag.key(), "test"); + assert_eq!(tag.value(), "hello1"); + } + + #[test] + fn query_cell() { + let mut fs = Fieldstat::new(); + let shared_tags = vec![ + FieldstatTag::new("tag1", 1), + ]; + let cell_tag = vec![ + FieldstatTag::new("tag cell", 123), + ]; + + fs.register_cube(shared_tags.as_slice(), SampleMode::Comprehensive, 100).unwrap(); + fs.cube_add(0, cell_tag.as_slice(), 1).unwrap(); + + let cell = fs.cube_read_cell(0).unwrap(); + assert_eq!(cell.len(), 1); + assert_eq!(cell[0].0, 0); // cell id + assert_eq!(cell[0].1.len(), 1); + if let FieldstatTagWrapper::LongLong(tag) = &cell[0].1[0] { + assert_eq!(tag.key(), "tag cell"); + assert_eq!(tag.value(), 123); + } else { + panic!("wrong tag type"); + } + } +}
\ No newline at end of file diff --git a/src/c_lang/fs4_binding.rs b/src/c_lang/fs4_binding.rs new file mode 100644 index 0000000..a425487 --- /dev/null +++ b/src/c_lang/fs4_binding.rs @@ -0,0 +1,961 @@ +#![allow(warnings)] + +/* automatically generated by rust-bindgen 0.65.1 */ + +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rename( + __old: *const ::std::os::raw::c_char, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __oldfd: ::std::os::raw::c_int, + __old: *const ::std::os::raw::c_char, + __newfd: ::std::os::raw::c_int, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __pfx: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + __stream: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char) + -> *mut FILE; +} +extern "C" { + pub fn fmemopen( + __s: *mut ::std::os::raw::c_void, + __len: usize, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __bufloc: *mut *mut ::std::os::raw::c_char, + __sizeloc: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __stream: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __modes: ::std::os::raw::c_int, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize); +} +extern "C" { + pub fn setlinebuf(__stream: *mut FILE); +} +extern "C" { + pub fn fprintf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn snprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fscanf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_fscanf"] + pub fn fscanf1( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_scanf"] + pub fn scanf1(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_sscanf"] + pub fn sscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vfscanf"] + pub fn vfscanf1( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vscanf"] + pub fn vscanf1( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vsscanf"] + pub fn vsscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __s: *mut ::std::os::raw::c_char, + __n: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getline( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __ptr: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __stream: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fwrite( + __ptr: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __s: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fread_unlocked( + __ptr: *mut ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fwrite_unlocked( + __ptr: *const ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fseek( + __stream: *mut FILE, + __off: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn rewind(__stream: *mut FILE); +} +extern "C" { + pub fn fseeko( + __stream: *mut FILE, + __off: __off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__stream: *mut FILE) -> __off_t; +} +extern "C" { + pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr(__stream: *mut FILE); +} +extern "C" { + pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__stream: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn perror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub static mut sys_nerr: ::std::os::raw::c_int; +} +extern "C" { + pub static sys_errlist: [*const ::std::os::raw::c_char; 0usize]; +} +extern "C" { + pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn flockfile(__stream: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__stream: *mut FILE); +} +extern "C" { + pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +pub type wchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[test] +fn bindgen_test_layout_max_align_t() { + const UNINIT: ::std::mem::MaybeUninit<max_align_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<max_align_t>(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::<max_align_t>(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce1) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__clang_max_align_nonce2) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +pub const metric_type_METRIC_TYPE_COUNTER: metric_type = 0; +pub const metric_type_METRIC_TYPE_HLL: metric_type = 1; +pub const metric_type_METRIC_TYPE_HISTOGRAM: metric_type = 2; +pub type metric_type = ::std::os::raw::c_uint; +pub const fs_tag_type_TAG_INTEGER: fs_tag_type = 0; +pub const fs_tag_type_TAG_DOUBLE: fs_tag_type = 1; +pub const fs_tag_type_TAG_CSTRING: fs_tag_type = 2; +pub type fs_tag_type = ::std::os::raw::c_uint; +pub const sampling_mode_SAMPLING_MODE_COMPREHENSIVE: sampling_mode = 0; +pub const sampling_mode_SAMPLING_MODE_TOPK: sampling_mode = 1; +pub type sampling_mode = ::std::os::raw::c_uint; +pub const counter_mode_COUNTER_MERGE_BY_SUM: counter_mode = 0; +pub const counter_mode_COUNTER_MERGE_BY_MAX: counter_mode = 1; +pub const counter_mode_COUNTER_MERGE_BY_MIN: counter_mode = 2; +pub type counter_mode = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct fieldstat_tag { + pub key: *const ::std::os::raw::c_char, + pub type_: fs_tag_type, + pub __bindgen_anon_1: fieldstat_tag__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union fieldstat_tag__bindgen_ty_1 { + pub value_longlong: ::std::os::raw::c_longlong, + pub value_double: f64, + pub value_str: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_fieldstat_tag__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<fieldstat_tag__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<fieldstat_tag__bindgen_ty_1>(), + 8usize, + concat!("Size of: ", stringify!(fieldstat_tag__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<fieldstat_tag__bindgen_ty_1>(), + 8usize, + concat!("Alignment of ", stringify!(fieldstat_tag__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).value_longlong) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag__bindgen_ty_1), + "::", + stringify!(value_longlong) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).value_double) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag__bindgen_ty_1), + "::", + stringify!(value_double) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).value_str) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag__bindgen_ty_1), + "::", + stringify!(value_str) + ) + ); +} +#[test] +fn bindgen_test_layout_fieldstat_tag() { + const UNINIT: ::std::mem::MaybeUninit<fieldstat_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<fieldstat_tag>(), + 24usize, + concat!("Size of: ", stringify!(fieldstat_tag)) + ); + assert_eq!( + ::std::mem::align_of::<fieldstat_tag>(), + 8usize, + concat!("Alignment of ", stringify!(fieldstat_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag), + "::", + stringify!(key) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag), + "::", + stringify!(type_) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fieldstat { + _unused: [u8; 0], +} +extern "C" { + pub fn fieldstat_new() -> *mut fieldstat; +} +extern "C" { + pub fn fieldstat_free(instance: *mut fieldstat); +} +extern "C" { + pub fn fieldstat_dup(instance: *const fieldstat) -> *mut fieldstat; +} +extern "C" { + pub fn fieldstat_register_cube( + instance: *mut fieldstat, + shared_tags: *const fieldstat_tag, + n_tag: usize, + mode: sampling_mode, + max_n_cell: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_unregister_cube( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_get_cube_version( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn fieldstat_register_counter( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + field_name: *const ::std::os::raw::c_char, + mode: counter_mode, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_register_hll( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + field_name: *const ::std::os::raw::c_char, + precision: ::std::os::raw::c_uchar, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_register_hist( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + field_name: *const ::std::os::raw::c_char, + lowest_trackable_value: ::std::os::raw::c_longlong, + highest_trackable_value: ::std::os::raw::c_longlong, + significant_figures: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_cube_add( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + tags: *const fieldstat_tag, + n_tag: usize, + increment: ::std::os::raw::c_longlong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_cube_remove( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + tags: *const fieldstat_tag, + n_tag: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_counter_incrby( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + increment: ::std::os::raw::c_longlong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_counter_set( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + value: ::std::os::raw::c_longlong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_hll_add( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + key: *const ::std::os::raw::c_char, + key_len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_hist_record( + instance: *mut fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + value: ::std::os::raw::c_longlong, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_reset(instance: *mut fieldstat); +} +extern "C" { + pub fn fieldstat_get_cell_version(instance: *const fieldstat) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fieldstat_merge(instance: *mut fieldstat, src: *mut fieldstat) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_deserialize( + blob: *const ::std::os::raw::c_char, + blob_size: usize, + ) -> *mut fieldstat; +} +extern "C" { + pub fn fieldstat_serialize( + instance: *const fieldstat, + blob_out: *mut *mut ::std::os::raw::c_char, + blob_size_out: *mut usize, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fieldstat_tag_list { + pub tag: *mut fieldstat_tag, + pub n_tag: usize, +} +#[test] +fn bindgen_test_layout_fieldstat_tag_list() { + const UNINIT: ::std::mem::MaybeUninit<fieldstat_tag_list> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<fieldstat_tag_list>(), + 16usize, + concat!("Size of: ", stringify!(fieldstat_tag_list)) + ); + assert_eq!( + ::std::mem::align_of::<fieldstat_tag_list>(), + 8usize, + concat!("Alignment of ", stringify!(fieldstat_tag_list)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag_list), + "::", + stringify!(tag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).n_tag) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(fieldstat_tag_list), + "::", + stringify!(n_tag) + ) + ); +} +extern "C" { + pub fn fieldstat_get_cubes( + instance: *const fieldstat, + cube_ids: *mut *mut ::std::os::raw::c_int, + n_cube: *mut ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn fieldstat_get_max_metric_id( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_get_metric_name( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn fieldstat_get_metric_type( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + ) -> metric_type; +} +extern "C" { + pub fn fieldstat_cube_read_cell( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + cell_ids: *mut *mut ::std::os::raw::c_int, + tag_list: *mut *mut fieldstat_tag_list, + n_cell: *mut usize, + ); +} +extern "C" { + pub fn fieldstat_get_cells( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_ids: *mut *mut ::std::os::raw::c_int, + tag_list: *mut *mut fieldstat_tag_list, + n_cell: *mut usize, + ); +} +extern "C" { + pub fn fieldstat_get_shared_tags( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + ) -> *mut fieldstat_tag_list; +} +extern "C" { + pub fn fieldstat_find_cube( + instance: *const fieldstat, + shared_tags: *const fieldstat_tag, + n_shared_tags: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_get_max_cell_id( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fieldstat_counter_get( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn fieldstat_hll_get( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + ) -> f64; +} +extern "C" { + pub fn fieldstat_hist_value_at_percentile( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + percentile: f64, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn fieldstat_hist_count_le_value( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + value: ::std::os::raw::c_longlong, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn fieldstat_get_serialized_blob( + instance: *const fieldstat, + cube_id: ::std::os::raw::c_int, + metric_id: ::std::os::raw::c_int, + cell_id: ::std::os::raw::c_int, + blob: *mut *mut ::std::os::raw::c_char, + blob_size: *mut usize, + ); +} +extern "C" { + pub fn fieldstat_tag_list_arr_free(tag_list: *mut fieldstat_tag_list, n_cell: usize); +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); +} diff --git a/src/c_lang/mod.rs b/src/c_lang/mod.rs new file mode 100644 index 0000000..a7683a2 --- /dev/null +++ b/src/c_lang/mod.rs @@ -0,0 +1,2 @@ +// pub(crate) mod fs4; +// pub(super) mod fs4_binding;
\ No newline at end of file |
