| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
The 'parsistent' adjective is misspelt.
|
|
|
|
|
|
|
|
|
|
| |
Let's support the same filtering options that we also support in
udevadm trigger in udevadm info to filter the devices produced by
--export-db.
One difference is that all properties specified by --propery-match=
have to be satisfied in udevadm info unlike udevadm trigger where just
one of them has to be satisfied.
|
|
|
|
|
| |
This allows getting the udevadm info --export-db and query "all" output
as JSON.
|
| |
|
|
|
|
| |
Also make the timer event source floating.
|
|
|
|
|
| |
Before we used the pager for --tree, but not e.g. for --export-db.
I don't see any particular reason to limit this.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
And while we are at it, let's use more appropriate open flags.
O_NONBLOCk is pointless in combination with O_NOFOLLOW.
O_NOFOLLOW makes a ton of sense otoh, since the inode is supposed to be
a dir, we just checked.
THe other flags are implied by xopendirat()
|
|
|
|
| |
sysfs is a tree, hence let's a mode that allows showing it as such.
|
|
|
|
|
|
| |
If multiple devices are specified on "udevadm info", then show data
about them all even if one is missing. Return first encountered error
though.
|
|
|
|
|
|
| |
Let's make it easier to discern the "header" of device records from the
"body", i.e. non-property data from property data, by using some
conservative coloring.
|
|
|
|
|
|
| |
Let's make things easier to debug, and show a more comprehensive set of
fields, extending on the existing output syntax that starts with one
marker character followed by a colon and a space.
|
| |
|
|
|
|
| |
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
|
|
|
|
|
|
|
|
| |
it might be totally inaccessible, hence weaken our language a bit and
just say "not readable", thus making not claim whether it is writable or
not.
Follow-up for 3a90bef55a5a71a03629a762470b0f9014cd8453
|
| |
|
| |
|
|
|
|
| |
Then we can easily find which pointer is NULL.
|
|
|
|
| |
See the comment in the code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
devices with the db_persist property won't be deleted during database
cleanup. This applies to dm and md devices in particular.
For such devices, we should also keep the files under /run/udev/links,
/run/udev/tags, and /run/udev/watch, to make sure that after restart,
udevd has the same information about the devices as it did before
the cleanup.
If we don't do this, a lower-priority device that is discovered in
the coldplug phase may take over symlinks from a device that persisted.
Not removing the watches also enables udevd to resume watching a device
after restart.
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
|
|
|
|
| |
which is safer than just checking dent[0].
Also, fix two style issues.
|
|\
| |
| | |
Make FOREACH_DIRENT and FOREACH_DIRENT_ALL declare the iterator variables
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The variable is not useful outside of the loop (it'll always be null
after the loop is finished), so we can declare it inline in the loop.
This saves one variable declaration and reduces the chances that somebody
tries to use the variable outside of the loop.
For consistency, 'de' is used everywhere for the var name.
|
|/ |
|
|
|
|
|
| |
which allows limiting the properties listed by the `--query=property` option
(and optionally listing only the respective values).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In general we almost never hit those asserts in production code, so users see
them very rarely, if ever. But either way, we just need something that users
can pass to the developers.
We have quite a few of those asserts, and some have fairly nice messages, but
many are like "WTF?" or "???" or "unexpected something". The error that is
printed includes the file location, and function name. In almost all functions
there's at most one assert, so the function name alone is enough to identify
the failure for a developer. So we don't get much extra from the message, and
we might just as well drop them.
Dropping them makes our code a tiny bit smaller, and most importantly, improves
development experience by making it easy to insert such an assert in the code
without thinking how to phrase the argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().
I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.
Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.
(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
|
|
|
|
| |
It seems no one will touch queue.bin
|
|
|
|
|
|
|
|
|
|
|
|
| |
I think this formatting was originally used because it simplified
adding new options to the help messages. However, these days, most
tools their help message end with "\nSee the %s for details.\n" so
the final line almost never has to be edited which eliminates the
benefit of the custom formatting used for printf() help messages.
Let's make things more consistent and use the same formatting for
printf() help messages that we use everywhere else.
Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
|
| |
|
|
|
|
| |
This makes it easier to accurately wait for a overall deadline.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed below systemd codesonar warning.
isprint() is invoked here with an argument of signed
type char, but only has defined behavior for int arguments that are
either representable as unsigned char or equal to the value
of macro EOF(-1).
As per codesonar report, in a number of libc implementations, isprint()
function implemented using lookup tables (arrays): passing in a
negative value can result in a read underrun.
|
| |
|
| |
|
|
|
|
| |
Closes #14959.
|
| |
|
|
|
|
| |
This seems not necessary, but just for safety.
|
| |
|
| |
|
| |
|
|
|
| |
This fixes a bug introduced by 13aca847695f49afeb93367ecdad76035fa6c139.
|
|
|
|
| |
Setting --export without --export-prefix is meaningless.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Found by inspecting results of running this small program:
int main(int argc, const char **argv) {
for (int i = 1; i < argc; i++) {
FILE *f;
char line[1024], prev[1024], *r;
int lineno;
prev[0] = '\0';
lineno = 1;
f = fopen(argv[i], "r");
if (!f)
exit(1);
do {
r = fgets(line, sizeof(line), f);
if (!r)
break;
if (strcmp(line, prev) == 0)
printf("%s:%d: error: dup %s", argv[i], lineno, line);
lineno++;
strcpy(prev, line);
} while (!feof(f));
fclose(f);
}
}
|
|
|
|
|
| |
This matches udevadm trigger, which allows multiple arguments since
80877656a55.
|
|
|
|
|
|
|
|
|
| |
This is convenient when working with device units in systemd. Instead of
converting the systemd unit name to a path to feed to udevadm, udevadm
info|trigger can be called directly on the unit name.
The man page is reworked a bit to describe the modern syntax with positional
arguments first. It's just simpler to use than the positional options.
|
| |
|