Skip to content

Commit 317da93

Browse files
committed
Fix DragonflyBSD build
1 parent 778912c commit 317da93

File tree

1 file changed

+59
-52
lines changed
  • src/unix/bsd/freebsdlike/dragonfly

1 file changed

+59
-52
lines changed

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 59 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ s! {
3131
pub e_exit: u16
3232
}
3333

34-
pub struct utmpx {
35-
pub ut_name: [::c_char; 32],
36-
pub ut_id: [::c_char; 4],
37-
38-
pub ut_line: [::c_char; 32],
39-
pub ut_host: [::c_char; 256],
40-
41-
pub ut_unused: [u8; 16],
42-
pub ut_session: u16,
43-
pub ut_type: u16,
44-
pub ut_pid: ::pid_t,
45-
ut_exit: exit_status,
46-
ut_ss: ::sockaddr_storage,
47-
pub ut_tv: ::timeval,
48-
pub ut_unused2: [u8; 16],
49-
}
50-
5134
pub struct aiocb {
5235
pub aio_fildes: ::c_int,
5336
pub aio_offset: ::off_t,
@@ -60,15 +43,6 @@ s! {
6043
_aio_err: ::c_int
6144
}
6245

63-
pub struct dirent {
64-
pub d_fileno: ::ino_t,
65-
pub d_namlen: u16,
66-
pub d_type: u8,
67-
__unused1: u8,
68-
__unused2: u32,
69-
pub d_name: [::c_char; 256],
70-
}
71-
7246
pub struct uuid {
7347
pub time_low: u32,
7448
pub time_mid: u16,
@@ -120,27 +94,6 @@ s! {
12094
pub f_uid_uuid: ::uuid_t,
12195
}
12296

123-
pub struct statfs {
124-
pub f_bsize: ::c_long,
125-
pub f_iosize: ::c_long,
126-
pub f_blocks: ::c_long,
127-
pub f_bfree: ::c_long,
128-
pub f_bavail: ::c_long,
129-
pub f_files: ::c_long,
130-
pub f_ffree: ::c_long,
131-
pub f_fsid: ::fsid_t,
132-
pub f_owner: ::uid_t,
133-
pub f_type: ::int32_t,
134-
pub f_flags: ::int32_t,
135-
pub f_syncwrites: ::c_long,
136-
pub f_asyncwrites: ::c_long,
137-
pub f_fstypename: [::c_char; 16],
138-
pub f_mntonname: [::c_char; 90],
139-
pub f_syncreads: ::c_long,
140-
pub f_asyncreads: ::c_long,
141-
pub f_mntfromname: [::c_char; 90],
142-
}
143-
14497
pub struct stat {
14598
pub st_ino: ::ino_t,
14699
pub st_nlink: ::nlink_t,
@@ -223,6 +176,58 @@ s! {
223176
}
224177
}
225178

179+
s_no_extra_traits! {
180+
#[allow(missing_debug_implementations)]
181+
pub struct utmpx {
182+
pub ut_name: [::c_char; 32],
183+
pub ut_id: [::c_char; 4],
184+
185+
pub ut_line: [::c_char; 32],
186+
pub ut_host: [::c_char; 256],
187+
188+
pub ut_unused: [u8; 16],
189+
pub ut_session: u16,
190+
pub ut_type: u16,
191+
pub ut_pid: ::pid_t,
192+
ut_exit: exit_status,
193+
ut_ss: ::sockaddr_storage,
194+
pub ut_tv: ::timeval,
195+
pub ut_unused2: [u8; 16],
196+
}
197+
198+
#[allow(missing_debug_implementations)]
199+
pub struct dirent {
200+
pub d_fileno: ::ino_t,
201+
pub d_namlen: u16,
202+
pub d_type: u8,
203+
__unused1: u8,
204+
__unused2: u32,
205+
pub d_name: [::c_char; 256],
206+
}
207+
208+
#[allow(missing_debug_implementations)]
209+
pub struct statfs {
210+
pub f_bsize: ::c_long,
211+
pub f_iosize: ::c_long,
212+
pub f_blocks: ::c_long,
213+
pub f_bfree: ::c_long,
214+
pub f_bavail: ::c_long,
215+
pub f_files: ::c_long,
216+
pub f_ffree: ::c_long,
217+
pub f_fsid: ::fsid_t,
218+
pub f_owner: ::uid_t,
219+
pub f_type: ::int32_t,
220+
pub f_flags: ::int32_t,
221+
pub f_syncwrites: ::c_long,
222+
pub f_asyncwrites: ::c_long,
223+
pub f_fstypename: [::c_char; 16],
224+
pub f_mntonname: [::c_char; 90],
225+
pub f_syncreads: ::c_long,
226+
pub f_asyncreads: ::c_long,
227+
pub f_mntfromname: [::c_char; 90],
228+
}
229+
}
230+
226231
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
227232
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
228233
pub const SIGSTKSZ: ::size_t = 40960;
@@ -804,26 +809,28 @@ f! {
804809
}
805810

806811
pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
807-
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize
812+
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize)
813+
as ::c_uint
808814
}
809815

810816
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
811817
-> *mut ::cmsghdr
812818
{
813-
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
819+
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
814820
+ _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
815821
let max = (*mhdr).msg_control as usize
816822
+ (*mhdr).msg_controllen as usize;
817823
if next <= max {
818-
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
824+
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize))
825+
as *mut ::cmsghdr
819826
} else {
820827
0 as *mut ::cmsghdr
821828
}
822829
}
823830

824831
pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
825-
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
826-
_CMSG_ALIGN(length as usize)
832+
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
833+
_CMSG_ALIGN(length as usize)) as ::c_uint
827834
}
828835
}
829836

0 commit comments

Comments
 (0)