mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
kldxref: Add -m filag to print info about modules in one file
kldxref -m <file> will print the same data that the '-d' flag produces, except restrict the output to one file. This should be the full path to the file, and the directory name to process is omitted. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57902
This commit is contained in:
1 parent
bcb1b157fd
commit
45f9f6ebac
2 files changed
+20
-4
No files matched your search
@@ -24,7 +24,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 25, 2023
|
||||
.Dd June 27, 2026
|
||||
.Dt KLDXREF 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -35,6 +35,8 @@
|
||||
.Op Fl Rdv
|
||||
.Op Fl f Ar hintsfile
|
||||
.Ar path ...
|
||||
.Nm
|
||||
.Fl m Ar module
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
@@ -67,6 +69,9 @@ output.
|
||||
.It Fl f Ar hintsfile
|
||||
Specify a different name for the hints files than
|
||||
.Pa linker.hints .
|
||||
.It Fl m Ar module
|
||||
Print information about the modules in the file
|
||||
.Ar module .
|
||||
.It Fl v
|
||||
Operate in verbose mode.
|
||||
.El
|
||||
|
||||
@@ -764,13 +764,13 @@ main(int argc, char *argv[])
|
||||
{
|
||||
FTS *ftsp;
|
||||
FTSENT *p;
|
||||
char *dot = NULL;
|
||||
char *dot = NULL, *module = NULL;
|
||||
int opt, fts_options;
|
||||
struct stat sb;
|
||||
|
||||
fts_options = FTS_PHYSICAL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "Rdf:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "Rdf:m:v")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd': /* no hint file, only print on stdout */
|
||||
dflag = true;
|
||||
@@ -778,6 +778,10 @@ main(int argc, char *argv[])
|
||||
case 'f': /* use this name instead of linker.hints */
|
||||
xref_file = optarg;
|
||||
break;
|
||||
case 'm':
|
||||
module = optarg;
|
||||
dflag = true;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
@@ -789,11 +793,18 @@ main(int argc, char *argv[])
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
if (argc - optind < 1)
|
||||
if (argc - optind < (module ? 0 : 1))
|
||||
usage();
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (module) {
|
||||
if (elf_version(EV_CURRENT) == EV_NONE)
|
||||
errx(1, "unsupported libelf");
|
||||
read_kld(module, module);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (stat(argv[0], &sb) != 0)
|
||||
err(1, "%s", argv[0]);
|
||||
if ((sb.st_mode & S_IFDIR) == 0 && !dflag) {
|
||||
|
||||
Reference in new issue
Block a user