Age | Commit message (Collapse) | Author |
|
|
|
Found when trying to update the toybox prebuilt used for the Android
build.
Also add the corresponding test.
|
|
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!
|
|
libbuf instead of toybuf in lib/
|
|
|
|
|
|
leaking memory), and mod env command to test it.
|
|
|
|
|
|
Although we can get away with ignoring termcap/terminfo on the output
side by restricting ourselves to generally-supported escape sequences,
the input side is trickier because we need to support the sequences sent
by common terminals. Luckily, this isn't is as bad as it sounds because
only Home/End commonly differ. But it does mean we need a slightly
different implementation to deal with the many-to-one mapping.
Since we can't use TAGGED_ARRAY for this (without inflicting pain on all
the callers) I've also switched to OR-ing in the modifier keys, so we
have (say) KEY_UP|KEY_SHIFT rather than a separate KEY_SUP. This also
generalizes better should we ever need to support multiple modifiers at
once.
To reduce the number of #defines, I've also switched from KEY_F1,
KEY_F2, and so on to KEY_FN+1, KEY_FN+2, and so on. This isn't obviously
necessary, and easily undone if we'd rather have move #defines in return
for slightly more natural naming.
To enable all this, I've inverted scan_key and scan_key_getsize so that
scan_key_getsize is now the underlying function, and we don't waste all
the top bits encoding width and height between scan_key and
scan_key_getsize.
Tested by pressing Home and End in hexedit in all of the terminals
available to me.
|
|
|
|
and tweak a couple comments.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
That could happen via the open of ".." too, and potentially any other
directory might have similar restrictions, so move all of the open calls
to using O_PATH.
O_PATH seems more intention-revealing given what this function is doing anyway.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
O_PATH seems more intention-revealing anyway.
|
|
and fix tests to pass on host too.
|
|
|
|
Now there's a second user... the libc function already null terminates
at len+1, and it doesn't malloc the full size if strlen() smaller so
the redundant termination stomped unallocated memory. Oops.
sort.c never noticed because it calculated length to truncate or copy
existing string, so never hit this.
|
|
|
|
|
|
|
|
|
|
stdin/stdout filehandles.
|
|
|
|
|
|
|
|
Inspired by some of the small patches that have gone by recently.
Limited to only things found in `generated/help.h`, plus a wider cleanup
for the more common "milisecond" typo.
|
|
always set SO_REUSEADDR (which won't reuse an active port but merely disables
the strange "but reply packets might come in after we close the socket"
hand-wringing timeout nobody's cared about in decades.)
|
|
|
|
|
|
it has clock_settime(), but not the libc adjtime() function...)
*shrug* Stub it out in portability.h.
|
|
|
|
Broke the bionic build:
external/toybox/toys/net/netcat.c:188:37: error: incompatible pointer types assigning to 'sigjmp_buf *' (aka 'long (*)[33]') from 'jmp_buf *' (aka 'long (*)[32]') [-Werror,-Wincompatible-pointer-types]
if (toys.optflags&FLAG_L) NOEXIT(child = XVFORK());
^~~~~~~~~~~~~~~~~~~~~~~~
external/toybox/lib/lib.h:375:19: note: expanded from macro 'NOEXIT'
#define NOEXIT(x) WOULD_EXIT(_noexit_res, x)
^~~~~~~~~~~~~~~~~~~~~~~~~~
external/toybox/lib/lib.h:367:16: note: expanded from macro 'WOULD_EXIT'
toys.rebound = &_noexit; \
^ ~~~~~~~~
1 error generated.
|
|
|
|
|
|
Used to construct SELinux policies in the AOSP build.
I left loopfiles_lines with its hard-coded '\n' because although cut(1)
also has a -z option, I can't find any case where it's used in any of
the codebases searchable by me. (And fmt(1), the other user, doesn't
even have the option.) YAGNI.
Bug: http://b/122744241
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This (eventually) lets "ps ax" and "ps -ax" behave differently.
|
|
|
|
|
|
Hopefully they'll fix this properly at some point, but until then...
|