xref: /rust-libc-0.2.174/libc-test/src/makedev.c (revision bb10d5f7)
1 #include <sys/types.h>
2 #if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(__CYGWIN__)
3 #include <sys/sysmacros.h>
4 #endif
5 
6 // Since makedev, major, minor are macros instead of functions, they aren't
7 // available to FFI. libc must reimplement them, which is error-prone. This
8 // file provides FFI access to the actual macros so they can be tested against
9 // the Rust reimplementation.
10 
makedev_ffi(unsigned major,unsigned minor)11 dev_t makedev_ffi(unsigned major, unsigned minor) {
12 	return makedev(major, minor);
13 }
14 
major_ffi(dev_t dev)15 unsigned int major_ffi(dev_t dev) {
16     return major(dev);
17 }
18 
minor_ffi(dev_t dev)19 unsigned int minor_ffi(dev_t dev) {
20     return minor(dev);
21 }
22