leading zeroes for some reason, so take the rightmost 8k of mask data
and test with leading zeroes. (It could instead specifically skip
leading zeroes, but would still have to check sizeof(toybuf) anyway.)
Again, the 6.16 kernel can only set NR_CPUS to 8k (1/4 of the bits in
toybuf) for 2 architectures (x86-64 and powerpc64, and ARM64 maxes out
at 4k (1/8 of toybuf). Last I checked nobody's made hardware anywhere
near that: they thought they might 20 years ago but NUMA didn't scale.
Beowulf clusters existed back in the 1990s and if you really want to
have a cluster mmap() shared memory from network storage you can just do
that and address contentional manually (with manual flock and madvise or
your own bespoke mechanism), or create data stores like riak, or...
Since util-linux/util-linux@6c87a3ac5e (taskset: Accept 0 pid for current
process), util-linux's taskset has accepted a 0 PID for the taskset
process.
Toybox has always had this behavior, inherited from sched_getaffinity(2)
and sched_setaffinity(2).
https://www.man7.org/linux/man-pages/man2/sched_getaffinity.2.html
Document the zero PID behavior and use it to simplify the tests.
Note that toybox and util-linux show different output. I'm not sure if
this should be considered a bug or not.
% ./toybox taskset 1 ./toybox taskset -p 0
pid 0's current affinity mask: 1
% ./taskset 1 ./taskset -p 0
pid 2140985's current affinity mask: 1
with toys.rebound to continue and accept additional input after error file,
reduce error message granularity (it worked or it didn't),
mark more functions static, use toybuf for input.
Fix tests to not look for specific error messages (fixes TEST_HOST).
Move sh_process allocation out of expand_redir() and have caller allocate
and supply it, so multiple expand_redir() calls can append to the
same argv[] and filehandle unredirect context.
Move argv[0] out of ff->arg into TT.argv0 (because $0 is special: shift
and $* don't include it, set can't update it, source and function calls
don't change it...)
Rename call_function() to add_fcall(), because sh_function is function()
definitions and sh_fcall is call stack.
Remove pp->envlen, and replace pp->flags/PFLAG_NOT with pp->not.
Make sh_fcall more sparse: instead of copying fields from parent context
search for them with find_fcall() (convenience wrapper: FIND_FF()) and
get_lineno(). Having one copy greatly simplifies updating the values.
Note: run_command() no longer returns NULL: pp->exit will be nonzero if
setup failed.
pgrep currently implements -l and -f, but not -a. It also inadvertently
treats -f as a combination of -a and -f, where we both filter via the
full command line and display the full command line. This violates
--help, where -f says "Check full command line for PATTERN".
Implement -a, which takes care of displaying the full command line, and
return -f to simply checking (filtering) via command line.
and move *type=='v' check back under distinguishing between vfat/iso9660
instead of run for all filetypes and potentially triggering if a new
4 letter physical filesystem type starting with v shows up in future.
Fixes `blkid -L`, and uses that to implement `mount LABEL=...`, the same way
`mount UUID=...` was implemented.
Previously blkid would erroneously print SEC_TYPE="msdos" for vfat filesystems
when the -L option was passed. This line is moved to only print it when neither
-U or -L are passed.
Also fixed to match util-linux's blkid behavior better: SEC_TYPE="msdos" is not
added to the list of tags when the vfat filesystem is fat32 (presumably because
fat32 is not compatible with msdos). A test is added to check this behavior.
To create the fat32.bz2 file used by the test, run the following commands:
$ fallocate -l33M fat32
$ mkfs.vfat -n myfat32 -i 0xB25B2ECB -F 32 fat32
$ bzip2 fat32
It's my first time submitting a patch to any project, so if there's anything I
should do differently in the future, please let me know.
By default, known broken tests are skipped, use "BROKEN= make test_sh" to
run them. This yanks 65 tests, leaving 289 which currently pass.
(A lot of the toysh test suite was always aspirational, notes-to-self
to handle some corner case. Unfortunately, that made it less useful for
regression testing changes...)
Add --no-mmap flag to indicate seek and read/write access. This allows
accessing devices that do not support mapping into memory - eg.
/dev/nvram, /dev/msr0 etc.
Also currently only WIDTH bytes are mapped into memory even when more
data is accessed. Fix this by mapping WIDTH * number of data.
Test: ./post_update.sh && m toybox. Push devmem test into DUT and access
/dev/mem through memory mapped access, /dev/nvram & /dev/msr* through
non memory-mapped access. Also update the toybox test cases to include
the non memory mapped access and confirm that all the tests are passing.
PASS: devmem read --no-mmap default (4)
PASS: devmem read --no-mmap 1
PASS: devmem read --no-mmap 2
PASS: devmem read --no-mmap 4
PASS: devmem read --no-mmap 8
PASS: devmem write 1
PASS: devmem write 2
PASS: devmem write 4
PASS: devmem write 8
PASS: devmem write --no-mmap 1
PASS: devmem write --no-mmap 2
PASS: devmem write --no-mmap 4
PASS: devmem write --no-mmap 8
PASS: devmem write 1 multiple
PASS: devmem write 2 multiple
PASS: devmem write 4 multiple
PASS: devmem write 8 multiple
PASS: devmem write --no-mmap 1 multiple
PASS: devmem write --no-mmap 2 multiple
PASS: devmem write --no-mmap 4 multiple
PASS: devmem write --no-mmap 8 multiple
Changelog since v1:
- Removed android specific files
- Removed xlseek after xwrite since xwrite advances the position
- Added test cases for --no-mmap access
diff should allow comparison between regular files and fifos
Added a few tests to help catch regressions here, and added
some cleanup for files the test creates.
The nextfile statement was failing because it left unprocessed input in the
record buffer from the current file. Mod to reset the buffer so it will get
data from the next file immediately. Add a test for the nextfile fix and also
for the preceding commit that fixed the 'getline var' bug (not setting it as a
numeric string if needed).
Yet again, I am victim of my own bad habit of only testing on my Debian
desktop... It turns out that [current] Debian od uses a single space
between fields, macOS od uses a tab between fields, and toybox od uses 4
spaces between fields. (Given that POSIX just says "one or more <blank>
characters", I assume this isn't a new problem.)
Sidestep this with NOSPACE=1 for all the od-using tests.
-f lets people use /dev/port for x86 i/o ports (rather than needing a
separate x86-only command), or /dev/nvram, or /dev/cpu/*/msr, or
/sys/bus/pci/devices/*:*:*.* ... you get the idea.
It also means we can write some tests. (Though of course, the tests
don't tell us whether this actually works with, /dev/foo, or whether
you actually need to lseek()+write() rather than mmap().)
Also support arbitrary numbers of writes (with address auto-increment).