This lets bb mount build for limited targets without syslog.h,
as long as the parts using it like NFS are disabled.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When mounting, in parallel, multiple loop devices (squashfs for the
submitter's case), the following behavior can be observed:
stat64(/path/to/image, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
openat(AT_FDCWD, /path/to/image, O_RDWR|O_LARGEFILE) = 3
openat(AT_FDCWD, /dev/loop-control, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 4
ioctl(4, LOOP_CTL_GET_FREE) = 12
close(4) = 0
openat(AT_FDCWD, /dev/loop12, O_RDWR|O_LARGEFILE) = 4
ioctl(4, LOOP_GET_STATUS64, {lo_offset=0, lo_number=12, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name=/path/to/image, ...}) = 0
close(4) = 0
close(3) = 0
write(2, "mount: can't setup loop device\n", 31mount: can't setup loop device
) = 31
exit_group(0) = ?
+++ exited with 0 +++
The ioctl LOOP_CTL_GET_FREE has resulted in the same result for
a competing mount process. The subsequent ioctl LOOP_GET_STATUS64
fails, having succeeded for the competing mount process.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The (1 << 8) MS_ flag is MS_NOSYMFOLLOW, not MS_UNION.
As far as I see in git history of kernel and util-linux,
MS_UNION did not ever exist.
Why did it appear in our tree in 2009?...
function old new delta
mount_option_str 379 385 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Fails as follows:
$ mount -o bind /dev/disk/by-path/pci-0000:13:00.0-scsi-0:0:3:0 /dir
mount: bad address '/dev/disk/by-path/pci-0000'
function old new delta
singlemount 1256 1273 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If logging to stderr and/or syslog the -v option can be given one or
more times to increase the log verbosity. If mdev is used as hotplug
helper the log level is fixed set to 2 if mdev.log is found an appended
because there is no possiblity to pass arguments to the hotplug helper.
Signed-off-by: Jan Klötzke <jan@kloetzke.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If mdev is run as daemon it should be possible to forward the debug
messages to syslog. This feature might be useful if mdev is run with -s
during boot too. OTOH it makes no sense for the daemon to log to
mdev.log. This can be handled by a syslog daemon way better. If the
daemon stays in the foreground due to -f, the messages are still written
to stderr as before.
Signed-off-by: Jan Klötzke <jan@kloetzke.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If the netlink read() failed with ENOBUFS we know that we have missed at
least one message due to a socket receive buffer overrun. The only way
how to recover is to drop the old socket, open a fresh one and make a
cold-plug scan of the current system state.
Signed-off-by: Jan Klötzke <jan@kloetzke.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The socket receive buffer turned out to be too small for real world
systems. Use the same size as udevd to be on the safe side. As this is
just a limit and the memory is not allocated by the kernel until really
needed there is actually no memory wasted.
Signed-off-by: Jan Klötzke <jan@kloetzke.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Starting with linux kernel v5.4 squashfs has a more strict parameter
checking implemented. Unlike util-linux mount, busybox never supported
the sizelimit option but simply forwards it to the kernel.
Since v5.4 mounting will fail with
squashfs: Unknown parameter 'sizelimit'
Support the sizelimit parameter by setting it in the LOOP_SET_STATUS64
structure before handing it to the kernel.
While at it also add support for the offset option, which currently will
always be set to 0.
function old new delta
cut_out_ull_opt - 167 +167
singlemount 1230 1266 +36
set_loop 834 862 +28
losetup_main 479 483 +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 235/0) Total: 235 bytes
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The glibc implementation changed for settimeofday, resulting in "invalid
argument" error when attempting to set both timezone and time with a single
call. Fix this by calling settimeofday twice
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
PLATFORM_LINUX is a hidden configuration option which is disabled by
default and enabled at over a hundred locations for features that are
deemed to be Linux specific.
The only effect of PLATFORM_LINUX is to control compilation of
libbb/match_fstype.c. This file is only needed by mount and umount.
Remove all references to PLATFORM_LINUX and compile match_fstype.c
if mount or umount is enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.
function old new delta
rdate_main 197 224 +27
clock_settime - 27 +27
date_main 926 941 +15
stime 37 - -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
function old new delta
taskset_main 511 855 +344
Based on patch by Fryderyk Wrobel <frd1996@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>