Skip to content

Commit 79d77f8

Browse files
committed
Fix openbsd build without unions
1 parent cc44c00 commit 79d77f8

File tree

1 file changed

+32
-26
lines changed
  • src/unix/bsd/netbsdlike/openbsdlike/openbsd

1 file changed

+32
-26
lines changed

src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,6 @@ s! {
2626
pub int_n_sign_posn: ::c_char,
2727
}
2828

29-
pub struct statfs {
30-
pub f_flags: ::uint32_t,
31-
pub f_bsize: ::uint32_t,
32-
pub f_iosize: ::uint32_t,
33-
pub f_blocks: ::uint64_t,
34-
pub f_bfree: ::uint64_t,
35-
pub f_bavail: ::int64_t,
36-
pub f_files: ::uint64_t,
37-
pub f_ffree: ::uint64_t,
38-
pub f_favail: ::int64_t,
39-
pub f_syncwrites: ::uint64_t,
40-
pub f_syncreads: ::uint64_t,
41-
pub f_asyncwrites: ::uint64_t,
42-
pub f_asyncreads: ::uint64_t,
43-
pub f_fsid: ::fsid_t,
44-
pub f_namemax: ::uint32_t,
45-
pub f_owner: ::uid_t,
46-
pub f_ctime: ::uint64_t,
47-
pub f_fstypename: [::c_char; 16],
48-
pub f_mntonname: [::c_char; 90],
49-
pub f_mntfromname: [::c_char; 90],
50-
pub f_mntfromspec: [::c_char; 90],
51-
pub mount_info: mount_info,
52-
}
53-
54-
#[cfg(libc_union)]
5529
pub union mount_info {
5630
pub ufs_args: ufs_args,
5731
pub mfs_args: mfs_args,
@@ -166,6 +140,35 @@ s! {
166140
}
167141
}
168142

143+
// This type uses the union mount_info:
144+
#[cfg(libc_union)]
145+
s! {
146+
pub struct statfs {
147+
pub f_flags: ::uint32_t,
148+
pub f_bsize: ::uint32_t,
149+
pub f_iosize: ::uint32_t,
150+
pub f_blocks: ::uint64_t,
151+
pub f_bfree: ::uint64_t,
152+
pub f_bavail: ::int64_t,
153+
pub f_files: ::uint64_t,
154+
pub f_ffree: ::uint64_t,
155+
pub f_favail: ::int64_t,
156+
pub f_syncwrites: ::uint64_t,
157+
pub f_syncreads: ::uint64_t,
158+
pub f_asyncwrites: ::uint64_t,
159+
pub f_asyncreads: ::uint64_t,
160+
pub f_fsid: ::fsid_t,
161+
pub f_namemax: ::uint32_t,
162+
pub f_owner: ::uid_t,
163+
pub f_ctime: ::uint64_t,
164+
pub f_fstypename: [::c_char; 16],
165+
pub f_mntonname: [::c_char; 90],
166+
pub f_mntfromname: [::c_char; 90],
167+
pub f_mntfromspec: [::c_char; 90],
168+
pub mount_info: mount_info,
169+
}
170+
}
171+
169172
//https://github.com/openbsd/src/blob/master/sys/sys/mount.h
170173
pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext
171174
pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers
@@ -262,7 +265,10 @@ extern {
262265
maxval: ::c_longlong,
263266
errstr: *mut *const ::c_char) -> ::c_longlong;
264267

268+
// these functions use statfs which uses the union mount_info:
269+
#[cfg(libc_union)]
265270
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
271+
#[cfg(libc_union)]
266272
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
267273

268274
pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;

0 commit comments

Comments
 (0)