Age | Commit message (Collapse) | Author |
|
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.)
|
|
These are Android specific, so not really helping the outside
community, and are getting more and more Android dependencies to work
correctly, so let's drop these from toybox and build them within
Android.
Change-Id: Ic6022f1f506e10868c61f55d64fa4e7c1b14eba2
|
|
into a structure passed as arguments, add x prefix to functions that can fail,
add overflow test.
|
|
Factor out the inotify code and add a kqueue equivalent.
Specifically tested on macOS 10.14, but I assume this works for other
BSDs too, given that I worked from the FreeBSD man page...
|
|
This is a 15 year old freebsd extension (presumably thus also available on
MacOS) that glibc adopted in 2004, uClibc adopted in 2005, and bionic
supports. The only thing that DOESN'T support it is musl, once again
because its maintainer explicitly decided not to
(https://www.openwall.com/lists/musl/2013/01/15/26), so add an #ifdef
to let musl stay uniquely broken. (It'll stop at first NUL, everything
else can match NULs).
Finally fixes "s/x/y/g on a megabyte line of x's takes forever" issue.
|
|
They're forwarded to libprocessgroup, but we may as well go straight to
the source since neither library is in the NDK anyway.
This code is unfortunate because it means that even `toybox true` ends
up pulling in a JSON parser at runtime, because ps might call
get_sched_policy/get_sched_policy_name. I'll experiment with
dlopen-on-demand in portability.c and see whether the savings are
worthwhile, but for now at least use the current library directly so we
can save *one* dlopen!
|
|
|
|
it has clock_settime(), but not the libc adjtime() function...)
*shrug* Stub it out in portability.h.
|
|
|
|
|
|
|
|
Hopefully they'll fix this properly at some point, but until then...
|
|
|
|
|
|
I've also flipped the `#if` because `#ifdef` feels more naturally readable
than #ifndef when there's also a `#else`.
(I've preserved the oddness of the clearenv declaration being here,
because there isn't currently a more suitable `#ifdef __APPLE__` to move
it too. Later...)
|
|
|
|
The only part of this I actually need for macOS is to remove __APPLE__
from the getdelim/getline workaround, but if we're following the usual
"seven year rule", glibc 2.10 is dead to us anyway, and we should just
remove all of this.
|
|
|
|
bionic, glibc, macOS, and musl all have strcasestr
(see http://man7.org/linux/man-pages/man3/strstr.3.html).
macOS (via BSD) has a strnstr that does what strnstr sounds like it
should do by analogy with strnlen and strncpy.
So we at least need to rename strnstr, but it probably makes more sense
just to switch to strcasestr instead.
|
|
The macOS libc headers use `__attribute__((noreturn))` rather than
`__attribute__((__noreturn__))`, so toybox's `noreturn` macro trips them
up. Since we already have a variety of uses of `__attribute__` that
aren't guarded in this way, let's do the same here.
|
|
|
|
|
|
|
|
Bug: https://github.com/landley/toybox/issues/43
|
|
It's possible that we should just pull setprop back out of toybox to
live with getprop in system/core/, but this lets us build the same toybox
configuration for device and host in AOSP.
(Longer term we'd like to use host bionic, but if we enable this we
can start experimenting on the tobyox side before the bionic side is
finished.)
|
|
/usr/include/unistd.h:626:15: error: conflicting types for 'confstr'
|
|
|
|
|
|
stuff syslog.h does into lib.c and portability.h
|
|
|
|
See http://lists.busybox.net/pipermail/buildroot/2016-December/180102.html
for a full post-mortem on the project.
|
|
|
|
I never use these, so I didn't notice I'd broken them until someone who
does bringup complained.
The "one weird trick" with SEEK_DATA is documented at the URL we already
point to. SEEK_DATA was added in Linux 3.1 (2011) and isn't available in
glibc 2.19 (2014), so I've added that to "portability.h" for the benefit
of Ubuntu 14.04.
Also make -c and -C mutually exclusive.
Also fix some of the formatting I introduced earlier. (A clang-format file
would help prevent these mistakes...)
|
|
|
|
|
|
both did it) so use getbasename instead.
|
|
|
|
have noticed yet.
|
|
This isn't a shell builtin, it uses prlimit to target any pid (without -P
it defaults to $PPID, so acts like historical ulimit by default).
|
|
checking, and fix up format checking complaints.
Added out(type, value) function to stat to avoid a zillion printf typecasts.
|
|
|
|
https://android-review.googlesource.com/159035/
|
|
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...
|
|
|
|
|
|
|
|
|
|
|
|
TOYBOX_DEBUG enabled.
One again gcc manages to be incompetent about producing warnings. For example,
in bzcat we error_exit() with a message that's an error code fed into an
array of string constants, and apparently dereferencing an array of string
literals doesn't give you a string literal according to -Wformat-security.
Not breaking the code to humor the compiler here, the compiler is wrong.
|
|
i'll be AFK for a week, so here's the patch i've been using this
evening to find other format string mistakes. BSD uses __printflike
and takes two arguments instead of hard-coding (1,2), but i figured
that as long as you don't need the generality you'd prefer not to have
it. and it's easy enough to retrofit if we ever do have a formatting
function that takes other arguments.
|