Skip to content

Commit b3d2389

Browse files
author
Folkert de Vries
committed
fix rebase problem
1 parent f550a24 commit b3d2389

File tree

2 files changed

+175
-54
lines changed

2 files changed

+175
-54
lines changed

src/fuchsia/mod.rs

+26-39
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl ::Clone for fpos64_t {
121121

122122
// PUB_STRUCT
123123

124-
fn s_fmt_tmp() {
124+
s! {
125125
pub struct group {
126126
pub gr_name: *mut ::c_char,
127127
pub gr_passwd: *mut ::c_char,
@@ -907,7 +907,7 @@ fn s_fmt_tmp() {
907907
}
908908
}
909909

910-
fn s_no_extra_traits_fmt_tmp() {
910+
s_no_extra_traits! {
911911
pub struct sysinfo {
912912
pub uptime: ::c_ulong,
913913
pub loads: [::c_ulong; 3],
@@ -1048,8 +1048,8 @@ fn s_no_extra_traits_fmt_tmp() {
10481048
}
10491049
}
10501050

1051-
fn cfg_if_fmt_tmp() {
1052-
if cfg_tmp!([feature = "extra_traits"]) {
1051+
cfg_if! {
1052+
if #[cfg(feature = "extra_traits")] {
10531053
impl PartialEq for sysinfo {
10541054
fn eq(&self, other: &sysinfo) -> bool {
10551055
self.uptime == other.uptime
@@ -3357,10 +3357,10 @@ pub const HUGETLB_FLAG_ENCODE_SHIFT: u32 = 26;
33573357
pub const MAP_HUGE_SHIFT: u32 = 26;
33583358

33593359
// intentionally not public, only used for fd_set
3360-
fn cfg_if_fmt_tmp() {
3361-
if cfg_tmp!([target_pointer_width = "32"]) {
3360+
cfg_if! {
3361+
if #[cfg(target_pointer_width = "32")] {
33623362
const ULONG_SIZE: usize = 32;
3363-
} else if cfg_tmp!([target_pointer_width = "64"]) {
3363+
} else if #[cfg(target_pointer_width = "64")] {
33643364
const ULONG_SIZE: usize = 64;
33653365
} else {
33663366
// Unknown target_pointer_width
@@ -3369,7 +3369,7 @@ fn cfg_if_fmt_tmp() {
33693369

33703370
// END_PUB_CONST
33713371

3372-
fn f_fmt_tmp() {
3372+
f! {
33733373
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
33743374
let fd = fd as usize;
33753375
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -3462,70 +3462,57 @@ fn f_fmt_tmp() {
34623462
}
34633463
}
34643464

3465-
/* FMT-CONST */
3466-
pub const fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
3465+
pub {const} fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
34673466
(len + ::mem::size_of::<::size_t>() - 1) & !(::mem::size_of::<::size_t>() - 1)
34683467
}
34693468

3470-
/* FMT-CONST */
3471-
pub const fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
3469+
pub {const} fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
34723470
(CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) as ::c_uint
34733471
}
34743472

3475-
/* FMT-CONST */
3476-
pub const fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
3473+
pub {const} fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
34773474
(CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + len as ::size_t) as ::c_uint
34783475
}
34793476
}
34803477

3481-
fn safe_f_fmt_tmp() {
3482-
/* FMT-CONST */
3483-
pub const fn WIFSTOPPED(status: ::c_int) -> bool {
3478+
safe_f! {
3479+
pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
34843480
(status & 0xff) == 0x7f
34853481
}
34863482

3487-
/* FMT-CONST */
3488-
pub const fn WSTOPSIG(status: ::c_int) -> ::c_int {
3483+
pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
34893484
(status >> 8) & 0xff
34903485
}
34913486

3492-
/* FMT-CONST */
3493-
pub const fn WIFCONTINUED(status: ::c_int) -> bool {
3487+
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
34943488
status == 0xffff
34953489
}
34963490

3497-
/* FMT-CONST */
3498-
pub const fn WIFSIGNALED(status: ::c_int) -> bool {
3491+
pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
34993492
((status & 0x7f) + 1) as i8 >= 2
35003493
}
35013494

3502-
/* FMT-CONST */
3503-
pub const fn WTERMSIG(status: ::c_int) -> ::c_int {
3495+
pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
35043496
status & 0x7f
35053497
}
35063498

3507-
/* FMT-CONST */
3508-
pub const fn WIFEXITED(status: ::c_int) -> bool {
3499+
pub {const} fn WIFEXITED(status: ::c_int) -> bool {
35093500
(status & 0x7f) == 0
35103501
}
35113502

3512-
/* FMT-CONST */
3513-
pub const fn WEXITSTATUS(status: ::c_int) -> ::c_int {
3503+
pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
35143504
(status >> 8) & 0xff
35153505
}
35163506

3517-
/* FMT-CONST */
3518-
pub const fn WCOREDUMP(status: ::c_int) -> bool {
3507+
pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
35193508
(status & 0x80) != 0
35203509
}
35213510

3522-
/* FMT-CONST */
3523-
pub const fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
3511+
pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
35243512
(cmd << 8) | (type_ & 0x00ff)
35253513
}
35263514

3527-
/* FMT-CONST */
3528-
pub const fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
3515+
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
35293516
let major = major as ::dev_t;
35303517
let minor = minor as ::dev_t;
35313518
let mut dev = 0;
@@ -4468,14 +4455,14 @@ extern "C" {
44684455
) -> ::c_int;
44694456
}
44704457

4471-
fn cfg_if_fmt_tmp() {
4472-
if cfg_tmp!([target_arch = "aarch64"]) {
4458+
cfg_if! {
4459+
if #[cfg(target_arch = "aarch64")] {
44734460
mod aarch64;
44744461
pub use self::aarch64::*;
4475-
} else if cfg_tmp!([any(target_arch = "x86_64")]) {
4462+
} else if #[cfg(any(target_arch = "x86_64"))] {
44764463
mod x86_64;
44774464
pub use self::x86_64::*;
4478-
} else if cfg_tmp!([any(target_arch = "riscv64")]) {
4465+
} else if #[cfg(any(target_arch = "riscv64"))] {
44794466
mod riscv64;
44804467
pub use self::riscv64::*;
44814468
} else {

src/unix/linux_like/linux/mod.rs

+149-15
Original file line numberDiff line numberDiff line change
@@ -1412,26 +1412,160 @@ s_no_extra_traits! {
14121412
pub offset_to_priv: ::__u32,
14131413
pub hdr: ::tpacket_bd_header_u,
14141414
}
1415-
}
14161415

1417-
s! {
1418-
// linux/ptp_clock.h
1419-
pub struct ptp_sys_offset {
1420-
pub n_samples: ::c_uint,
1421-
pub rsv: [::c_uint; 3],
1422-
pub ts: [ptp_clock_time; 2 * PTP_MAX_SAMPLES as usize + 1],
1416+
#[cfg_attr(
1417+
all(
1418+
any(target_env = "musl", target_env = "ohos"),
1419+
target_pointer_width = "32"
1420+
),
1421+
repr(align(4))
1422+
)]
1423+
#[cfg_attr(
1424+
all(
1425+
any(target_env = "musl", target_env = "ohos"),
1426+
target_pointer_width = "64"
1427+
),
1428+
repr(align(8))
1429+
)]
1430+
#[cfg_attr(
1431+
all(
1432+
not(any(target_env = "musl", target_env = "ohos")),
1433+
target_arch = "x86"
1434+
),
1435+
repr(align(4))
1436+
)]
1437+
#[cfg_attr(
1438+
all(
1439+
not(any(target_env = "musl", target_env = "ohos")),
1440+
not(target_arch = "x86")
1441+
),
1442+
repr(align(8))
1443+
)]
1444+
pub struct pthread_cond_t {
1445+
#[doc(hidden)]
1446+
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
14231447
}
14241448

1425-
pub struct ptp_pin_desc {
1426-
pub name: [::c_char; 64],
1427-
pub index: ::c_uint,
1428-
pub func: ::c_uint,
1429-
pub chan: ::c_uint,
1430-
pub rsv: [::c_uint; 5],
1449+
#[cfg_attr(
1450+
all(
1451+
target_pointer_width = "32",
1452+
any(
1453+
target_arch = "mips",
1454+
target_arch = "mips32r6",
1455+
target_arch = "arm",
1456+
target_arch = "hexagon",
1457+
target_arch = "m68k",
1458+
target_arch = "csky",
1459+
target_arch = "powerpc",
1460+
target_arch = "sparc",
1461+
target_arch = "x86_64",
1462+
target_arch = "x86"
1463+
)
1464+
),
1465+
repr(align(4))
1466+
)]
1467+
#[cfg_attr(
1468+
any(
1469+
target_pointer_width = "64",
1470+
not(any(
1471+
target_arch = "mips",
1472+
target_arch = "mips32r6",
1473+
target_arch = "arm",
1474+
target_arch = "hexagon",
1475+
target_arch = "m68k",
1476+
target_arch = "csky",
1477+
target_arch = "powerpc",
1478+
target_arch = "sparc",
1479+
target_arch = "x86_64",
1480+
target_arch = "x86"
1481+
))
1482+
),
1483+
repr(align(8))
1484+
)]
1485+
pub struct pthread_mutex_t {
1486+
#[doc(hidden)]
1487+
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
1488+
}
1489+
1490+
#[cfg_attr(
1491+
all(
1492+
target_pointer_width = "32",
1493+
any(
1494+
target_arch = "mips",
1495+
target_arch = "mips32r6",
1496+
target_arch = "arm",
1497+
target_arch = "hexagon",
1498+
target_arch = "m68k",
1499+
target_arch = "csky",
1500+
target_arch = "powerpc",
1501+
target_arch = "sparc",
1502+
target_arch = "x86_64",
1503+
target_arch = "x86"
1504+
)
1505+
),
1506+
repr(align(4))
1507+
)]
1508+
#[cfg_attr(
1509+
any(
1510+
target_pointer_width = "64",
1511+
not(any(
1512+
target_arch = "mips",
1513+
target_arch = "mips32r6",
1514+
target_arch = "arm",
1515+
target_arch = "hexagon",
1516+
target_arch = "m68k",
1517+
target_arch = "powerpc",
1518+
target_arch = "sparc",
1519+
target_arch = "x86_64",
1520+
target_arch = "x86"
1521+
))
1522+
),
1523+
repr(align(8))
1524+
)]
1525+
pub struct pthread_rwlock_t {
1526+
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
1527+
}
1528+
1529+
#[cfg_attr(
1530+
all(
1531+
target_pointer_width = "32",
1532+
any(
1533+
target_arch = "mips",
1534+
target_arch = "mips32r6",
1535+
target_arch = "arm",
1536+
target_arch = "hexagon",
1537+
target_arch = "m68k",
1538+
target_arch = "csky",
1539+
target_arch = "powerpc",
1540+
target_arch = "sparc",
1541+
target_arch = "x86_64",
1542+
target_arch = "x86"
1543+
)
1544+
),
1545+
repr(align(4))
1546+
)]
1547+
#[cfg_attr(
1548+
any(
1549+
target_pointer_width = "64",
1550+
not(any(
1551+
target_arch = "mips",
1552+
target_arch = "mips32r6",
1553+
target_arch = "arm",
1554+
target_arch = "hexagon",
1555+
target_arch = "m68k",
1556+
target_arch = "csky",
1557+
target_arch = "powerpc",
1558+
target_arch = "sparc",
1559+
target_arch = "x86_64",
1560+
target_arch = "x86"
1561+
))
1562+
),
1563+
repr(align(8))
1564+
)]
1565+
pub struct pthread_barrier_t {
1566+
size: [u8; ::__SIZEOF_PTHREAD_BARRIER_T],
14311567
}
1432-
}
14331568

1434-
s_no_extra_traits! {
14351569
// linux/net_tstamp.h
14361570
#[allow(missing_debug_implementations)]
14371571
pub struct sock_txtime {

0 commit comments

Comments
 (0)