[Toybox] [PATCH] macOS: numerous fixes.

enh enh at google.com
Fri Jun 7 16:29:53 PDT 2019


This patch adds a BSD version of xgetmountlist (for the path ==
NULL case only), tested on macOS. It also papers over the differences
between macOS' and Linux's xattr APIs. For once I think the macOS
one is better. The imitation of mknodat I've had to write swings
things back in Linux's favor though.

BSD calls f_frsize by the name f_iosize instead. (FWIW, it looks
like this is meaningless on Linux and actually meaningful on macOS.)

I've added one #if to toys/ --- I'm calling pathconf in stat.c to
work around the absence of f_namelen, and have left a TODO with an
explanation. I'm not sure what the best fix is here, so punting.

No-one can agree what f_fsid is, even if they're all basically the
same, so work around the `val` versus `__val` issue between macOS
and Linux.

With this patch, it's now possible to build cp/mv/install and stat
for macOS too. (Which completes the set of "toybox commands currently
used on Linux as part of the AOSP build" if you ignore stuff that
deals with processes, which I doubt we'll ever be able to support
for lack of any API.)

---
 lib/lsm.h         |   1 -
 lib/portability.c | 162 ++++++++++++++++++++++++++++++++++++++++++++--
 lib/portability.h |  22 ++++++-
 toys/other/stat.c |  14 +++-
 toys/posix/cp.c   |  10 +--
 5 files changed, 193 insertions(+), 16 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-macOS-numerous-fixes.patch
Type: application/octet-stream
Size: 11413 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190607/c6eba95c/attachment.obj>


More information about the Toybox mailing list