[Toybox] [PATCH] Fix dev_minor()/dev_major()/dev_makedev() for Mac.

enh enh at google.com
Fri Nov 22 12:57:36 PST 2019


Major/minor device encoding is not portable. No two BSDs agree with
each other, and Darwin is different again.

Everyone does agree on having major()/minor()/makedev() macros, but
they disagree whether they should be in <sys/types.h> (the BSDs
including Darwin, and old versions of glibc) or <sys/sysmacros.h>
(glibc >= 2.26 and bionic).

This fixes `ls -l /dev/zero` and `stat /dev/zero` on Mac.

---
 lib/lib.c         | 15 ---------------
 lib/lib.h         |  3 ---
 lib/portability.c | 33 +++++++++++++++++++++++++++++++++
 lib/portability.h |  5 +++++
 4 files changed, 38 insertions(+), 18 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-dev_minor-dev_major-dev_makedev-for-Mac.patch
Type: application/octet-stream
Size: 3012 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20191122/0e11c095/attachment-0002.obj>


More information about the Toybox mailing list