File oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch of Package oprofile

From: Maynard Johnson <maynardj@us.ibm.com>
Subject: Fix "Unable to open cpu_type file for reading" for IBM POWER7+
Git-commit: 88ed74bade0096042d643a6d7e68c2cbc4b6e34d
Date: Thu Jan 9 15:07:21 2014 -0600

    Fix "Unable to open cpu_type file for reading" for IBM POWER7+
    
    Using operf to do profiling on an IBM POWER7+ may result in
    the following error message:
    
    	Unable to open cpu_type file for reading
    
    This patch fixes the problem.  There is also a simple workaround of
    running 'opcontrol --init'.
    
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
index cd75ad4..7d5262c 100644
--- a/libop/op_cpu_type.c
+++ b/libop/op_cpu_type.c
@@ -326,6 +326,8 @@ static op_cpu _get_ppc64_cpu_type(void)
 	for (i = 0; i < (int)len ; i++)
 		cpu_name_lowercase[i] = tolower(cpu_name[i]);
 
+	if (strncmp(cpu_name_lowercase, "power7+", 7) == 0)
+		cpu_name_lowercase[6] = '\0';
 	cpu_type_str[0] = '\0';
 	strcat(cpu_type_str, "ppc64/");
 	strncat(cpu_type_str, cpu_name_lowercase, len);
openSUSE Build Service is sponsored by