diff --git a/src/analysis/conversion_type.rs b/src/analysis/conversion_type.rs index 1fabeb129..60f12e4ac 100644 --- a/src/analysis/conversion_type.rs +++ b/src/analysis/conversion_type.rs @@ -71,6 +71,13 @@ impl ConversionType { Filename => Self::Pointer, OsString => Self::Pointer, Type => Self::Scalar, + TimeT => Self::Direct, + OffT => Self::Direct, + DevT => Self::Direct, + GidT => Self::Direct, + PidT => Self::Direct, + SockLenT => Self::Direct, + UidT => Self::Direct, None => Self::Unknown, IntPtr => Self::Direct, UIntPtr => Self::Direct, diff --git a/src/analysis/ffi_type.rs b/src/analysis/ffi_type.rs index 0df9a678c..3583ff28a 100644 --- a/src/analysis/ffi_type.rs +++ b/src/analysis/ffi_type.rs @@ -94,6 +94,13 @@ fn ffi_inner(env: &Env, tid: TypeId, inner: &str) -> Result { SSize => "libc::ssize_t", Float => "libc::c_float", Double => "libc::c_double", + TimeT => "libc::time_t", + OffT => "libc::off_t", + DevT => "libc::dev_t", + GidT => "libc::gid_t", + PidT => "libc::pid_t", + SockLenT => "libc::socklen_t", + UidT => "libc::uid_t", UniChar => "u32", Utf8 => "libc::c_char", Filename => "libc::c_char", diff --git a/src/codegen/sys/ffi_type.rs b/src/codegen/sys/ffi_type.rs index fdab83664..58168f941 100644 --- a/src/codegen/sys/ffi_type.rs +++ b/src/codegen/sys/ffi_type.rs @@ -90,6 +90,13 @@ fn ffi_inner(env: &Env, tid: library::TypeId, mut inner: String) -> Result { ULong => "c_ulong", Size => "size_t", SSize => "ssize_t", + TimeT => "time_t", + OffT => "off_t", + DevT => "dev_t", + GidT => "gid_t", + PidT => "pid_t", + SockLenT => "socklen_t", + UidT => "uid_t", Float => "c_float", Double => "c_double", UniChar => "u32", diff --git a/src/codegen/sys/statics.rs b/src/codegen/sys/statics.rs index 87d2b1e27..74bc1732b 100644 --- a/src/codegen/sys/statics.rs +++ b/src/codegen/sys/statics.rs @@ -20,7 +20,10 @@ pub fn after_extern_crates(w: &mut dyn Write) -> Result<()> { "#[allow(unused_imports)]", "use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,", " c_short, c_ushort, c_long, c_ulong,", - " c_void, size_t, ssize_t, intptr_t, uintptr_t, FILE};", + " c_void, size_t, ssize_t, time_t, off_t, intptr_t, uintptr_t, FILE};", + "#[cfg(unix)]", + "#[allow(unused_imports)]", + "use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};", ]; write_vec(w, &v) diff --git a/src/library.rs b/src/library.rs index 63d24d3bd..1b0f60640 100644 --- a/src/library.rs +++ b/src/library.rs @@ -230,6 +230,13 @@ pub enum Basic { Type, IntPtr, UIntPtr, + TimeT, + OffT, + DevT, + GidT, + PidT, + SockLenT, + UidT, // Same encoding as Filename but can contains any string // Not defined in GLib directly OsString, @@ -303,6 +310,13 @@ const BASIC: &[(&str, Basic)] = &[ // TODO: this is temporary name, change it when type added to GLib ("os_string", Basic::OsString), ("bool", Basic::Bool), + ("time_t", Basic::TimeT), + ("off_t", Basic::OffT), + ("dev_t", Basic::DevT), + ("gid_t", Basic::GidT), + ("pid_t", Basic::PidT), + ("socklen_t", Basic::SockLenT), + ("uid_t", Basic::UidT), ]; #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]