Commit Graph

10 Commits

Author SHA1 Message Date
Elliott Hughes
78954416db macOS: numerous fixes.
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.)
2019-06-08 13:10:10 -05:00
Rob Landley
9aebc5f1a7 Ed Maste says freebsd hasn't got sys/xattr.h, so move it to portability.h. 2019-01-08 18:37:15 -06:00
Rob Landley
288321ac86 Tweaks to make building with Android NDK's llvm happier. 2018-09-08 15:42:50 -05:00
Elliott Hughes
145b7024b5 Fix warning: 'XATTR_NAME_SMACK' macro redefined.
Recent Linux uapi <linux/xattr.h> headers define XATTR_NAME_SMACK.
The <sys/xattr.h> include at the top of lib/lsm.h means that even
though the direct include of <linux/xattr.h> is guarded, it may
have already happened transitively anyway.

(The alternative fixes would be to hard-code the correct value for
XATTR_NAME_SMACK here instead, or #undef XATTR_NAME_SMACK.)
2016-08-02 15:26:07 -05:00
Rob Landley
2f7c98e109 The xattr functions were added during the 2.5 kernel, lsm.h can #include the
header unconditionally. (This fixes the warning when CP_PRESERVE disabled.)
2016-03-12 15:56:40 -06:00
Rob Landley
df07fb73be Wean scripts/install.c off toys.h so cross compiling less brittle. 2016-02-10 23:27:55 -06:00
Rob Landley
d20b9ff3ee Don't pass target $CFLAGS to host builds (telling x86 compiler to be big-endian
seldom ends well). Instead add -DBUILD_FOR_HOST to $HOSTCC and wrap #ifdefs
around problematic (smack) includes from toys.h.
2015-11-02 08:32:21 -06:00
Rob Landley
2d66e6a238 Attempt to fix the mkdir LSM race.
Doing a world writeable mkdir and _then_ adding a label seems like a race
window, so set the global "create stuff with these labels" context, then
do the creates.
2015-05-28 01:43:47 -05:00
Rob Landley
0cb5b70fa4 Switch id over to new infrastructure, switch id to use FORCE_FLAGS, and
make lib/lsm.h auto-include from toys.h.
2015-05-18 19:14:53 -05:00
Rob Landley
c565b06325 More ls -Z upgrading. Move TOYBOX_SELINUX and TOYBOX_SMACK support from
portability.h to new lib/lsm.h. Update ls.c to use it.

Fix "ls . toys" (two directories when one is . or ..), which was filtering
out the . as something we shouldn't recurse into even though it was explicitly
listed on the command line. For some reason "ls -Z . toys" is still segfaulting
though (but "ls -Z ." isn't), need to figure out why...
2015-05-18 02:00:43 -05:00