lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191028220137.GF28772@krava>
Date:   Mon, 28 Oct 2019 23:01:37 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, eranian@...gle.com,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v3 1/7] perf pmu: Use file system cache to optimize sysfs
 access

On Fri, Oct 25, 2019 at 11:14:11AM -0700, Andi Kleen wrote:

SNIP

>  	if (pmu_aliases_parse(path, head))
>  		return -1;
> @@ -525,7 +524,6 @@ static int pmu_alias_terms(struct perf_pmu_alias *alias,
>   */
>  static int pmu_type(const char *name, __u32 *type)
>  {
> -	struct stat st;
>  	char path[PATH_MAX];
>  	FILE *file;
>  	int ret = 0;
> @@ -537,7 +535,7 @@ static int pmu_type(const char *name, __u32 *type)
>  	snprintf(path, PATH_MAX,
>  		 "%s" EVENT_SOURCE_DEVICE_PATH "%s/type", sysfs, name);
>  
> -	if (stat(path, &st) < 0)
> +	if (access(path, R_OK) < 0)

why not file_available call in here?

jirka

>  		return -1;
>  
>  	file = fopen(path, "r");
> @@ -628,14 +626,11 @@ static struct perf_cpu_map *pmu_cpumask(const char *name)
>  static bool pmu_is_uncore(const char *name)
>  {
>  	char path[PATH_MAX];
> -	struct perf_cpu_map *cpus;
> -	const char *sysfs = sysfs__mountpoint();
> +	const char *sysfs;
>  
> +	sysfs = sysfs__mountpoint();
>  	snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name);

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ