RFC: lsfd, a brand new Linux specific replacement for lsof by masatake · Pull Request #1418 · util-linux/util-linux
add filters; yes I know, you can use grep,
You don't know about my private plan for RHEL13 :-P
LOL, would you please say more about? ;-)
I think we should add filtering API to libsmartcols first.
Yes, in many cases it makes sense to use the libscols_table as a container where the application keeps data (and in some cases, it's impossible, for example in lsblk the tree of data is too complex and in lscpu the data capturing is very tricky.)
Base on the API we can add a tcp dump alike filtering language to the command line interface of ALL commands using llibsmartcols (if you want:-).
We can addlsfd --type ...or anything we want based on the language.About lsfd, just adding the API to llibsmartcols is not enough.
Like Wireshark, there can be a "display filter" and a "capturing filter".
The API is for implementing the display filter.
I more and more think about "liblsdata" to handle also data capturing part of the applications. Now many operations
are pretty simple, read from any file, convert to human-readable size, or to some predefined static string, or call snprintf(), etc. And with capture filters, we can drive it in a more elegant (effective) way without extra code in applications.
Maybe it would be also possible to replace
switch(data_id) {
case FOO:
str = read_file("/soemthing");
break
case BAR:
xasprinf(&str, "%d", data->bar);
break
}
with:
lsdata {
[FOO] = { LS_FILE, "/something", ...},
[BAR] = { LS_STUCT, get_data_func, offsetof(struct data, bar), }
};
not sure, and maybe it's overengineering :-)
The capturing filter will be part of lsfd. The capturing filter may improve the execution time of lsfd drastically.
Yes.