[2/3] ntdll: Implement NtQuerySystemInformation/SystemLogicalProcessorInformation (try 5)
Alexandre Julliard
julliard at winehq.org
Fri Oct 8 07:26:28 CDT 2010
Rudolf Mayerhofer <rm at eightyfive.net> writes:
> +/***********************************************************************
> + * Several methods to retrieve data from SysFS (/sys)
> + * used to retrieve cached_lpi in fill_cpu_info()
> + */
> +static int sysfs_cpu_exists(int cpu)
> +{
> + char buf[256];
> +
> + sprintf(buf, "/sys/devices/system/cpu/cpu%d", cpu);
> + return access(buf, F_OK) == 0;
> +}
> +
> +static int sysfs_cpucache_exists(int cpu, int cache)
> +{
> + char buf[256];
> +
> + sprintf(buf, "/sys/devices/system/cpu/cpu%d/cache/index%d", cpu, cache);
> + return access(buf, F_OK) == 0;
> +}
> +
> +static int sysfs_numanode_exists(int node)
> +{
> + char buf[256];
> +
> + sprintf(buf, "/sys/devices/system/node/node%d", node);
> + return access(buf, F_OK) == 0;
> +}
Don't do that sort of thing. You should handle failures to open the
files at the point where you need them instead of doing redundant
checks.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list