summaryrefslogtreecommitdiff
path: root/libc-test/build.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-06 07:25:56 +0000
committerbors <bors@rust-lang.org>2023-05-06 07:25:56 +0000
commitf4cae6738d79a7f00011787b76ee5d82b4bd14b9 (patch)
treea9973d2e4ed073d6e1a01c36f31e006bd002e970 /libc-test/build.rs
parent461807bbd16fb1bf8ad076cc839f57ca4ca0b9d1 (diff)
parent6c19c7cad690bcf1904c92743f7c160d6d445a2f (diff)
downloadrust-libc-f4cae6738d79a7f00011787b76ee5d82b4bd14b9.tar.gz
Auto merge of #2999 - SteveLauC:major/minor-on-BSDs, r=<try>try
add major/minor on BSDs/illumos This PR adds `major/minor` on BSDs and `major/minor/makedev` on illumos. Ref: * [FreeBSD 11](https://github.com/freebsd/freebsd-src/blob/3e9337c6b211e778829ed3af783cd41447a8721b/sys/sys/types.h#L372-L374) ```c #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ ``` * [FreeBSD 12/13/14](https://github.com/freebsd/freebsd-src/blob/3d98e253febf816e6e2aea7d3b1c013c421895de/sys/sys/types.h#L332-L341) ```c static __inline int __major(dev_t _d) { return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff)); } static __inline int __minor(dev_t _d) { return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff)); } ``` * [DragonFly](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/d7a10f947f5344fc95e874ca3b83e9e8d0986b25/sys/sys/types.h#L170-L171) ```c #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ ``` * [NetBSD](https://github.com/NetBSD/src/blob/a25a6fec1b0a676fc5b36fa01b2990e775775d90/sys/sys/types.h#L264-L266) ```c #define major(x) ((devmajor_t)(((uint32_t)(x) & 0x000fff00) >> 8)) #define minor(x) ((devminor_t)((((uint32_t)(x) & 0xfff00000) >> 12) | \ (((uint32_t)(x) & 0x000000ff) >> 0))) ``` * [OpenBSD](https://github.com/openbsd/src/blob/05cbc9aa8d8372e83274c75e35add6b8073c26f5/sys/sys/types.h#L211-L212) ```c #define major(x) (((unsigned)(x) >> 8) & 0xff) #define minor(x) ((unsigned)((x) & 0xff) | (((x) & 0xffff0000) >> 8)) ``` * illumos: 1. [mkdev.c](https://github.com/illumos/illumos-gate/blob/8b26092d555bd1deaacf79ea64da374602aefb65/usr/src/lib/libc/port/gen/mkdev.c#L40-L146) 2. [mkdev.h](https://github.com/illumos/illumos-gate/blob/8b26092d555bd1deaacf79ea64da374602aefb65/usr/src/uts/common/sys/mkdev.h#L97-L99)
Diffstat (limited to 'libc-test/build.rs')
-rw-r--r--libc-test/build.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index e23b0d0a37..5db14d467d 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -821,6 +821,7 @@ fn test_solarish(target: &str) {
"sys/ioctl.h",
"sys/lgrp_user.h",
"sys/loadavg.h",
+ "sys/mkdev.h",
"sys/mman.h",
"sys/mount.h",
"sys/priv.h",