Age | Commit message (Collapse) | Author |
|
with memset() instead of = {}, and move TT.alarm to local variable.
|
|
Some of the bringup folks are debugging RTC issues and asked for this.
Rather than duplicate the weird xtzset dance with mktime, I've factored
that out into a new xmktime that takes a boolean for whether to use UTC
or local time.
Otherwise, the slight cleanup of hwclock.c is entirely optional. The
only functional change there is that util-linux 2.34's hwclock uses ISO
time format, which is the usual toybox preference anyway, so I've
switched it over to that rather than ctime(3).
Bug: http://b/152042947
|
|
The recent re-enablement of the BLKGETSIZE64 code broke the Mac
build. Use the equivalent <sys/disk.h> ioctl() pair instead.
|
|
I came here because the new -Wno-unreachable-code-loop-increment warning
didn't like the for loop on line 86. That loop is indeed not necessary.
Use strend() to do a string suffix match.
Use memmem() to search. It's available on macOS and Android by default,
but it's behind _GNU_SOURCE for glibc, so add that to portability.h.
Output the tags in the same order as the Debian modinfo.
I've left "parmtype" in even though the Debian modinfo doesn't output it
at all.
Also fix the tests so that they work on a device that has modules for
multiple kernels installed (like my laptop) --- make sure that the two
modules we pick come from the same kernel.
|
|
(Also show unknown values on Linux in hex rather than just "unknown".)
|
|
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.
|
|
Includes new tests.
|
|
and #define/#undef a second symbol for the else case.
|
|
|
|
And check in more multicast support that's been sitting in the tree, I don't
have a test enviornment for it anymore but somebody wanted this...
|
|
out clang's __has_include(), and && shorts out the eval for gcc.
|
|
macOS doesn't have real-time signals, and it has a slightly different
set of non-portable signals from Linux.
With this, the toybox `kill -l` output matches the default macOS kill(1).
|
|
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.
|