Skip to content

Commit 253fd92

Browse files
committed
gnu: Add proper structs for fpos_t and fpos64_t
1 parent 78408f0 commit 253fd92

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,24 @@ s! {
389389
#[cfg(target_pointer_width = "64")]
390390
__size: [c_char; 32],
391391
}
392+
393+
pub struct mbstate_t {
394+
__count: c_int,
395+
__wchb: [c_char; 4],
396+
}
397+
398+
pub struct fpos64_t {
399+
__pos: off64_t,
400+
__state: crate::mbstate_t,
401+
}
402+
403+
pub struct fpos_t {
404+
#[cfg(not(gnu_file_offset_bits64))]
405+
__pos: off_t,
406+
#[cfg(gnu_file_offset_bits64)]
407+
__pos: off64_t,
408+
__state: crate::mbstate_t,
409+
}
392410
}
393411

394412
impl siginfo_t {

src/unix/linux_like/linux/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,14 @@ pub type iconv_t = *mut c_void;
7474
pub type sctp_assoc_t = __s32;
7575

7676
pub type eventfd_t = u64;
77-
missing! {
78-
#[cfg_attr(feature = "extra_traits", derive(Debug))]
79-
pub enum fpos64_t {} // FIXME(linux): fill this out with a struct
77+
78+
cfg_if! {
79+
if #[cfg(not(target_env = "gnu"))] {
80+
missing! {
81+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
82+
pub enum fpos64_t {} // FIXME(linux): fill this out with a struct
83+
}
84+
}
8085
}
8186

8287
e! {

src/unix/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,18 @@ cfg_if! {
538538
}
539539
}
540540

541+
cfg_if! {
542+
if #[cfg(not(target_env = "gnu"))] {
543+
missing! {
544+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
545+
pub enum fpos_t {} // FIXME(unix): fill this out with a struct
546+
}
547+
}
548+
}
549+
541550
missing! {
542551
#[cfg_attr(feature = "extra_traits", derive(Debug))]
543552
pub enum FILE {}
544-
#[cfg_attr(feature = "extra_traits", derive(Debug))]
545-
pub enum fpos_t {} // FIXME(unix): fill this out with a struct
546553
}
547554

548555
extern "C" {

0 commit comments

Comments
 (0)