Page MenuHomeFreeBSD

D40048.id122631.diff
No OneTemporary

D40048.id122631.diff

diff --git a/lib/libpmcstat/libpmcstat.h b/lib/libpmcstat/libpmcstat.h
--- a/lib/libpmcstat/libpmcstat.h
+++ b/lib/libpmcstat/libpmcstat.h
@@ -98,7 +98,7 @@
#define FLAG_READ_LOGFILE 0x00000200 /* -R file */
#define FLAG_DO_GPROF 0x00000400 /* -g */
#define FLAG_HAS_SAMPLESDIR 0x00000800 /* -D dir */
-#define FLAG_HAS_KERNELPATH 0x00001000 /* -k kernel */
+/* was FLAG_HAS_KERNELPATH 0x00001000 */
#define FLAG_DO_PRINT 0x00002000 /* -o */
#define FLAG_DO_CALLGRAPHS 0x00004000 /* -G or -F */
#define FLAG_DO_ANNOTATE 0x00008000 /* -m */
@@ -121,7 +121,6 @@
char *pa_outputpath; /* path to output log */
void *pa_logparser; /* log file parser */
const char *pa_fsroot; /* FS root where executables reside */
- char *pa_kernel; /* pathname of the kernel */
const char *pa_samplesdir; /* directory for profile files */
const char *pa_mapfilename;/* mapfile name */
FILE *pa_graphfile; /* where to send the callgraph */
diff --git a/lib/libpmcstat/libpmcstat_image.c b/lib/libpmcstat/libpmcstat_image.c
--- a/lib/libpmcstat/libpmcstat_image.c
+++ b/lib/libpmcstat/libpmcstat_image.c
@@ -315,7 +315,6 @@
GElf_Shdr sh;
enum pmcstat_image_type image_type;
char buffer[PATH_MAX];
- char buffer_modules[PATH_MAX];
assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN);
@@ -330,32 +329,19 @@
assert(path != NULL);
/*
- * Look for kernel modules under FSROOT/KERNELPATH/NAME and
- * FSROOT/boot/modules/NAME, and user mode executable objects
- * under FSROOT/PATHNAME.
+ * Look for files under FSROOT/PATHNAME.
*/
- if (image->pi_iskernelmodule) {
- (void) snprintf(buffer, sizeof(buffer), "%s%s/%s",
- args->pa_fsroot, args->pa_kernel, path);
- (void) snprintf(buffer_modules, sizeof(buffer_modules),
- "%s/boot/modules/%s", args->pa_fsroot, path);
- } else {
- (void) snprintf(buffer, sizeof(buffer), "%s%s",
- args->pa_fsroot, path);
- }
+ (void) snprintf(buffer, sizeof(buffer), "%s%s",
+ args->pa_fsroot, path);
e = NULL;
fd = open(buffer, O_RDONLY, 0);
- if (fd < 0 && !image->pi_iskernelmodule) {
+ if (fd < 0) {
warnx("WARNING: Cannot open \"%s\".",
buffer);
goto done;
}
- if (fd < 0 && (fd = open(buffer_modules, O_RDONLY, 0)) < 0) {
- warnx("WARNING: Cannot open \"%s\" or \"%s\".",
- buffer, buffer_modules);
- goto done;
- }
+
if (elf_version(EV_CURRENT) == EV_NONE) {
warnx("WARNING: failed to init elf\n");
goto done;
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -5394,7 +5394,7 @@
CK_LIST_FOREACH(po, &pmc_ss_owners, po_ssnext)
if (po->po_flags & PMC_PO_OWNS_LOGFILE)
pmclog_process_map_in(po, (pid_t) -1,
- (uintfptr_t) lf->address, lf->filename);
+ (uintfptr_t) lf->address, lf->pathname);
PMC_EPOCH_EXIT();
/*
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -2119,7 +2119,7 @@
i = 0;
TAILQ_FOREACH(lf, &linker_files, link) {
/* Save the info for this linker file. */
- kobase[i].pm_file = lf->filename;
+ kobase[i].pm_file = lf->pathname;
kobase[i].pm_address = (uintptr_t)lf->address;
i++;
}
diff --git a/usr.sbin/pmcstat/pmcstat.8 b/usr.sbin/pmcstat/pmcstat.8
--- a/usr.sbin/pmcstat/pmcstat.8
+++ b/usr.sbin/pmcstat/pmcstat.8
@@ -57,7 +57,6 @@
.Op Fl f Ar pluginopt
.Op Fl g
.Op Fl i Ar lwp
-.Op Fl k Ar kerneldir
.Op Fl l Ar secs
.Op Fl m Ar pathname
.Op Fl n Ar rate
@@ -336,17 +335,6 @@
.Xr ps 1
.Fl o
.Li lwp .
-.It Fl k Ar kerneldir
-Set the pathname of the kernel directory to argument
-.Ar kerneldir .
-This directory specifies where
-.Nm
-should look for the kernel and its modules.
-The default is to use the path of the running kernel obtained from the
-.Va kern.bootfile
-sysctl.
-Modules will also be searched for in /boot/modules if not found in
-.Ar kerneldir .
.It Fl l Ar secs
Set system-wide performance measurement duration for
.Ar secs
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -383,7 +383,6 @@
"\t -f spec\t pass \"spec\" to as plugin option\n"
"\t -g\t\t produce gprof(1) compatible profiles\n"
"\t -i lwp\t\t filter on thread id \"lwp\" in post-processing\n"
- "\t -k dir\t\t set the path to the kernel\n"
"\t -l secs\t set duration time\n"
"\t -m file\t print sampled PCs to \"file\"\n"
"\t -n rate\t set sampling rate\n"
@@ -456,7 +455,7 @@
int use_cumulative_counts;
short cf, cb;
uint64_t current_sampling_count;
- char *end, *tmp, *event;
+ char *end, *event;
const char *errmsg, *graphfilename;
enum pmcstat_state runstate;
struct pmc_driverstats ds_start, ds_end;
@@ -465,7 +464,6 @@
struct kevent kev;
struct winsize ws;
struct stat sb;
- char buffer[PATH_MAX];
uint32_t caps;
check_driver_stats = 0;
@@ -510,16 +508,6 @@
caps = 0;
CPU_ZERO(&cpumask);
-
- /* Default to using the running system kernel. */
- len = 0;
- if (sysctlbyname("kern.bootfile", NULL, &len, NULL, 0) == -1)
- err(EX_OSERR, "ERROR: Cannot determine path of running kernel");
- args.pa_kernel = malloc(len);
- if (args.pa_kernel == NULL)
- errx(EX_SOFTWARE, "ERROR: Out of memory.");
- if (sysctlbyname("kern.bootfile", args.pa_kernel, &len, NULL, 0) == -1)
- err(EX_OSERR, "ERROR: Cannot determine path of running kernel");
len = sizeof(domains);
if (sysctlbyname("vm.ndomains", &domains, &len, NULL, 0) == -1)
err(EX_OSERR, "ERROR: Cannot get number of domains");
@@ -623,12 +611,8 @@
break;
case 'k': /* pathname to the kernel */
- free(args.pa_kernel);
- args.pa_kernel = strdup(optarg);
- if (args.pa_kernel == NULL)
- errx(EX_SOFTWARE, "ERROR: Out of memory");
- args.pa_required |= FLAG_DO_ANALYSIS;
- args.pa_flags |= FLAG_HAS_KERNELPATH;
+ warnx("WARNING: -k is obsolete, has no effect "
+ "and will be removed in FreeBSD 15.");
break;
case 'L':
@@ -1029,12 +1013,6 @@
"ERROR: option -O is used only with options -E, -P, -S and -W."
);
- /* -k kernel path require -g/-G/-m/-T or -R */
- if ((args.pa_flags & FLAG_HAS_KERNELPATH) &&
- (args.pa_flags & FLAG_DO_ANALYSIS) == 0 &&
- (args.pa_flags & FLAG_READ_LOGFILE) == 0)
- errx(EX_USAGE, "ERROR: option -k is only used with -g/-R/-m/-T.");
-
/* -D only applies to gprof output mode (-g) */
if ((args.pa_flags & FLAG_HAS_SAMPLESDIR) &&
(args.pa_flags & FLAG_DO_GPROF) == 0)
@@ -1058,36 +1036,6 @@
"ERROR: option -O is required if counting and sampling PMCs are specified together."
);
- /*
- * Check if 'kerneldir' refers to a file rather than a
- * directory. If so, use `dirname path` to determine the
- * kernel directory.
- */
- (void) snprintf(buffer, sizeof(buffer), "%s%s", args.pa_fsroot,
- args.pa_kernel);
- if (stat(buffer, &sb) < 0)
- err(EX_OSERR, "ERROR: Cannot locate kernel \"%s\"",
- buffer);
- if (!S_ISREG(sb.st_mode) && !S_ISDIR(sb.st_mode))
- errx(EX_USAGE, "ERROR: \"%s\": Unsupported file type.",
- buffer);
- if (!S_ISDIR(sb.st_mode)) {
- tmp = args.pa_kernel;
- args.pa_kernel = strdup(dirname(args.pa_kernel));
- if (args.pa_kernel == NULL)
- errx(EX_SOFTWARE, "ERROR: Out of memory");
- free(tmp);
- (void) snprintf(buffer, sizeof(buffer), "%s%s",
- args.pa_fsroot, args.pa_kernel);
- if (stat(buffer, &sb) < 0)
- err(EX_OSERR, "ERROR: Cannot stat \"%s\"",
- buffer);
- if (!S_ISDIR(sb.st_mode))
- errx(EX_USAGE,
- "ERROR: \"%s\" is not a directory.",
- buffer);
- }
-
/*
* If we have a callgraph be created, select the outputfile.
*/

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 5:11 PM (13 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14806495
Default Alt Text
D40048.id122631.diff (7 KB)

Event Timeline