@@ -117,16 +117,12 @@ get_read_format( unsigned int multiplex,
117117
118118#if defined(__powerpc__ )
119119#define __NR_perf_event_open 319
120- #define __NR_capget 183
121120#elif defined(__x86_64__ )
122121#define __NR_perf_event_open 298
123- #define __NR_capget 125
124122#elif defined(__i386__ )
125123#define __NR_perf_event_open 336
126- #define __NR_capget 184
127124#elif defined(__arm__ )
128125#define __NR_perf_event_open 364+0x900000
129- #define __NR_capget 184+0x900000
130126#endif
131127
132128#endif
@@ -604,10 +600,6 @@ _peu_init_component( int cidx )
604600 FILE * fff ;
605601 char * strCpy ;
606602
607- struct __user_cap_header_struct cap_header ;
608- struct __user_cap_data_struct cap_data [2 ];
609- int perfmon_capabilities ;
610-
611603 our_cidx = cidx ;
612604
613605 /* The is the official way to detect if perf_event support exists */
@@ -627,13 +619,18 @@ _peu_init_component( int cidx )
627619 fclose (fff );
628620
629621 /* Check for availability of perf_event through capabilities */
622+ int perfmon_capabilities = 0 ;
623+ #if defined(__NR_capget )
624+ struct __user_cap_header_struct cap_header ;
625+ struct __user_cap_data_struct cap_data [2 ];
630626
631627 memset ( & cap_header , 0 , sizeof (cap_header ) );
632628 memset ( cap_data , 0 , sizeof (cap_data ) );
629+
633630 cap_header .version = _LINUX_CAPABILITY_VERSION_3 ;
634631 cap_header .pid = 0 ;
635- retval = syscall (__NR_capget , & cap_header , & cap_data );
636632
633+ retval = syscall (__NR_capget , & cap_header , & cap_data );
637634 if (retval < 0 ) {
638635 strCpy = strncpy ( _papi_hwd [cidx ]-> cmp_info .disabled_reason ,
639636 "Error querying Linux capabilities" ,PAPI_MAX_STR_LEN );
@@ -649,7 +646,7 @@ _peu_init_component( int cidx )
649646 #else
650647 perfmon_capabilities = cap_data [0 ].permitted & (1 << CAP_SYS_ADMIN );
651648 #endif
652-
649+ #endif
653650 /* Run the libpfm4-specific setup */
654651
655652 retval = _papi_libpfm4_init (_papi_hwd [cidx ]);
0 commit comments